Coder Social home page Coder Social logo

anonymous_github_download's Introduction

anonymous_github_download

download anonymous github folder

  1. 首先点开所有的folder,用F12打开并复制源代码部分,保存到文件,如a.txt
  2. 解析网页结构
import os
from bs4 import BeautifulSoup
with open('a.txt','r') as f:
    html=f.readline()
# print(html)
soup=BeautifulSoup(html,'html.parser')
  1. 开始下载
import os
url='https://anonymous.4open.science'
def getFile(file):
    os.system('wget '+url+file.find('a').get('href'))
    pass
def getFolder(folder):
    if folder.contents[0].name=='a':
        dir_name=folder.contents[0].get_text()
        folder=folder.contents[1]
    else:
        dir_name='aaa'
        folder=folder.contents[0]
    os.makedirs(dir_name)
    cwd=os.getcwd()
    os.chdir(cwd+'/'+dir_name)
    # print(cwd+'/'+dir_name)
    for i in folder.contents:
        if i.name !='li':continue
        if 'folder' in i.get('class'):getFolder(i)
        else: getFile(i)
    os.chdir(cwd)
getFolder(soup.contents[0])

会创建一个aaa文件夹,所有文件按结构下载在aaa文件夹下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.