forked from Yangzhedi/pythonSpider
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_userInfo.py
More file actions
27 lines (24 loc) · 897 Bytes
/
github_userInfo.py
File metadata and controls
27 lines (24 loc) · 897 Bytes
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
# coding:utf-8
import requests
from bs4 import BeautifulSoup
from github_followXXXList import count
import time
url = 'https://github.com/'
headers = {
'User-Agent': '' # ur user-Agent here,
}
def get_user_info(url,person):
data = requests.get(url + person, headers=headers)
soup = BeautifulSoup(data.text, 'lxml')
name = soup.select('div > div.vcard-names-container.py-3.js-sticky. > h1 > span.vcard-fullname')
intrduction = soup.select('div.user-profile-bio > div')
counts = soup.select('div.user-profile-nav > nav > a.underline-nav-item > span')
dic = {
'name':name[0].get_text(),
'intrduction':intrduction[0].get_text(),
'repsoitories_count': count(counts[0]),
'followers_count': count(counts[2]),
'following_count': count(counts[3]),
'post_star':count(counts[1]),
}
return dic