-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGitHubProfileExtracter.py
More file actions
61 lines (48 loc) · 1.73 KB
/
GitHubProfileExtracter.py
File metadata and controls
61 lines (48 loc) · 1.73 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
# TACTICAL HACKER -:- https://github.com/TacticalHacker
#Python Script to extract Profile Info from GitHub
import requests
from bs4 import BeautifulSoup
GitID = input("Enter GitHub username: ")
type(GitID)
try:
# specify the url
quote_page = 'https://github.com/'
quote_page = quote_page + GitID
# query the website and return the html to the variable 'page'
page = requests.get(quote_page)
# parse the html using beautiful soap and store in variable `soup`
soup = BeautifulSoup(page.text, 'html.parser')
except:
print("Please enter a valid GitHub username.")
quit()
print("\n\nGITHUB PROFILE INFO OF "+ GitID + ": \n")
try:
fullname_box = soup.find('span', attrs={'class': 'p-name vcard-fullname d-block overflow-hidden'})
fullname = fullname_box.text.strip()
print("FULLNAME: " + fullname)
except:
print("Something went wrong while accessing Fullname!")
try:
username_box = soup.find('span', attrs={'class': 'p-nickname vcard-username d-block'})
username = username_box.text.strip()
print("USERNAME: " + username)
except:
print("Something went wrong while accessing Username!")
try:
address_box = soup.find('span', attrs={'class': 'p-label'})
address = address_box.text.strip()
print("ADDRESS: " + address)
except:
print("Something went wrong while accessing Address!")
try:
repositories_box = soup.find('span', attrs={'class': 'Counter'})
repositories = repositories_box.text.strip()
print("REPOSITORIES: " + repositories)
except:
print("Something went wrong while accessing Repositories!")
try:
contribution_box = soup.find('h2', attrs={'class': 'f4 text-normal mb-2'})
contribution = contribution_box.text
print("OTHER ACTIVITIES: "+contribution)
except:
print("Something went wrong while accessing Other Contributions!")