Skip to content

Commit 38c2eb0

Browse files
committed
githubspider
1 parent aae69ab commit 38c2eb0

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,4 @@ get_follow_lists(url,person,boo,pages):
2323

2424
**url**, **person** ,**boo**和上一个方法一样,**pages**是指想获取第几页的following或者followers的列表
2525

26-
方法返回当前page的following或者followers的列表,结合
27-
```
28-
get_follow_counts_pages
29-
```
30-
可以获取所以的following或者followers的列表
26+
方法返回当前page的following或者followers的列表,结合*get_follow_counts_pages*结合可以获取所以的following或者followers的列表
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
url = 'https://github.com/'
77
default_url = 'https://github.com'
88
headers = {
9-
'User-Agent': # ur user-Agent here
9+
'User-Agent': '' # ur user-Agent here
1010
}
1111

1212
result_lists = []

‎github/githubUserInfo.py‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# coding:utf-8
2+
import requests
3+
from bs4 import BeautifulSoup
4+
from githubFollowingList import count
5+
import time
6+
7+
url = 'https://github.com/'
8+
9+
headers = {
10+
'User-Agent': '' # ur user-Agent here,
11+
}
12+
13+
def get_user_info(url,person):
14+
data = requests.get(url + person, headers=headers)
15+
soup = BeautifulSoup(data.text, 'lxml')
16+
name = soup.select('div > div.vcard-names-container.py-3.js-sticky. > h1 > span.vcard-fullname')
17+
intrduction = soup.select('div.user-profile-bio > div')
18+
counts = soup.select('div.user-profile-nav > nav > a.underline-nav-item > span')
19+
dic = {
20+
'name':name[0].get_text(),
21+
'intrduction':intrduction[0].get_text(),
22+
'repsoitories_count': count(counts[0]),
23+
'followers_count': count(counts[2]),
24+
'following_count': count(counts[3]),
25+
'post_star':count(counts[1]),
26+
}
27+
return dic

0 commit comments

Comments
 (0)