-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgit-awards.py
114 lines (105 loc) · 2.6 KB
/
git-awards.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import requests
from bs4 import BeautifulSoup
import re
head = "http://git-awards.com/users/"
var = input()
URL = head + var
page = requests.get(URL)
soup = BeautifulSoup(page.content,'html.parser')
a = list(soup.findAll('div',class_='col-md-3 info'))
b = list(soup.findAll('td'))
lang=[]
f = 0
for i in a:
c = i.text.lstrip().rstrip()
if 'your ranking' in c and f==0:
f=1
continue
if 'ranking' in c:
s=""
d = c.split(" ")
for j in d:
if j!="ranking":
s+=j+" "
lang.append(s.rstrip())
print(lang)
record = []
s=""
k=0
i=0
while(i<len(b)):
c = b[i].text.lstrip().rstrip()
if "We couldn't find your city from your location on GitHub" in c:
s = "0-0-"
s+= "Worldwide-"
d = b[i+2].text.split("/")
r1=""
r2=""
for j in d[0]:
if j>='0' and j<='9':
r1+=j
for j in d[1]:
if j>='0' and j<='9':
r2+=j
s+= r1 + "-" + r2 + "-"
s+= "Repos-"
s+= b[i+4].text.rstrip().lstrip()+"-"
s+= "Stars-"
s+= b[i+6].text.rstrip().lstrip()
s = lang[k] + "-" + s
record.append(s)
k+=1
i = i+7
else:
s = b[i].text + "-"
d = b[i+1].text.split("/")
r1=""
r2=""
for j in d[0]:
if j>='0' and j<='9':
r1+=j
for j in d[1]:
if j>='0' and j<='9':
r2+=j
s+= r1 + "-" + r2 + "-"
s += b[i+2].text + "-"
d = b[i+3].text.split("/")
r1=""
r2=""
for j in d[0]:
if j>='0' and j<='9':
r1+=j
for j in d[1]:
if j>='0' and j<='9':
r2+=j
s+= r1 + "-" + r2 + "-"
i = i+3
s+= "Worldwide-"
d = b[i+2].text.split("/")
r1=""
r2=""
for j in d[0]:
if j>='0' and j<='9':
r1+=j
for j in d[1]:
if j>='0' and j<='9':
r2+=j
s+= r1 + "-" + r2 + "-"
s+= "Repos-"
s+= b[i+4].text.rstrip().lstrip()+"-"
s+= "Stars-"
s+= b[i+6].text.rstrip().lstrip()
s = lang[k] + "-" + s
record.append(s)
k+=1
i = i+7
print(record)
#s=""
#record=[]
#f=1
#for i in len(b):
#c = b[i].text.lstrip().rstrip()
#if f==0:
#record.append(s)
#f=1
#for j in c and :