-
Notifications
You must be signed in to change notification settings - Fork 6
/
gitdl.py
29 lines (29 loc) · 1.11 KB
/
gitdl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#coding = utf-8
#author:Jumbo
import requests
import re
import urllib
page = range(1,5)
github_username = raw_input('github_username:')
for pg in page:
url = 'https://github.com/%s?page=%s&tab=&tab=stars' %(github_username,pg)
get = requests.get(url)
regex = r' \<a href=\"(.*?)\"\>\s+\<span'
key = re.findall(regex,get.content)
for k in key:
#print k
url2 = 'https://github.com/'
xiangmu_name = url2 + k
print xiangmu_name
url3 = '/archive/master.zip'
download = xiangmu_name + url3
print download
filename = urllib.urlopen(download)
info = filename.info()
filename_regex = 'Content-Disposition: attachment; filename=(.*)'
filename_down = re.findall(filename_regex,str(info))
#print filename_down
for filename1 in filename_down:
print filename1
filename2 = filename1.strip()
urllib.urlretrieve(download,filename2)