-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.py
More file actions
98 lines (58 loc) · 2.18 KB
/
github.py
File metadata and controls
98 lines (58 loc) · 2.18 KB
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
from bs4 import BeautifulSoup
import requests
def email(github_username):
github_url = "http://github.com/" + github_username
github_html = requests.get(github_url)
soup = BeautifulSoup(github_html.content)
email = soup.find_all('a',{'class':'email'})
email = str(email[0])
index = email.find('>') + 1
email = email[index:]
index = email.find("<")
email = email[:index]
return email
def name(github_username):
github_url = "http://github.com/" + github_username
github_html = requests.get(github_url)
soup = BeautifulSoup(github_html.content)
name = str(soup.title)
index = name.find("(") + 1
name = name[index:]
index = name.find(")")
name = name[:index]
return name
def website(github_username):
github_url = "http://github.com/" + github_username
github_html = requests.get(github_url)
soup = BeautifulSoup(github_html.content)
website = str(soup.find_all('a', {'class': 'url'})[0])
index = website.find('>') + 1
website = website[index:]
index = website.find("<")
website = website[:index]
return website
def date_joined(github_username):
github_url = "http://github.com/" + github_username
github_html = requests.get(github_url)
soup = BeautifulSoup(github_html.content)
date_joined = str(soup.find_all('time', {'class':'join-date'})[0])
index = date_joined.find('>') + 1
date_joined = date_joined[index:]
index = date_joined.find("<")
date_joined = date_joined[:index]
return date_joined
def location(github_username):
github_url = "http://github.com/" + github_username
github_html = requests.get(github_url)
soup = BeautifulSoup(github_html.content)
location = str(soup.find_all('li', {'itemprop':'homeLocation'})[0])
index = location.find('</span') + 7
location = location[index:]
index = location.find("<")
location = location[:index]
return location
def getAll(github_username):
#L=[name(github_username),website(github_username),email(github_username),date_joined(github_username),location(github_username)]
d={"Name": name(github_username),"Website" : website(github_username),"E-mail":email(github_username),"Joindate":date_joined(github_username),"Location":location(github_username)}
return d
print getAll("mikachoow21")