Skip to content

Commit 8c19ff3

Browse files
committed
..
1 parent 34d5295 commit 8c19ff3

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎github/githubFollowXXXList.py‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
result_lists = []
1313

14-
def counts2pages(Tag):
14+
15+
def count(Tag):
1516
str = Tag.get_text().replace(' ','').strip('\n').encode('utf-8')
1617
leng = len(str)-1
1718
if str[-1] == 'k':
18-
pages = int(float(str[:leng]) * 1000)/51 + 1
19+
count = int(float(str[:leng]) * 1000)
1920
else:
20-
pages = int(str)/51 + 1
21-
return pages
21+
count = int(str)
22+
return count
2223

2324
def get_follow_counts_pages(url,person,boo):
2425
followXXX = 'following' if boo else 'followers'
@@ -28,9 +29,9 @@ def get_follow_counts_pages(url,person,boo):
2829
counts = soup.select('div.user-profile-nav > nav > a.underline-nav-item > span')
2930
# 如果boo 是真,说明是following ,counts[3]
3031
if boo:
31-
return counts2pages(counts[3])
32+
return (count(counts[3]))/51 + 1
3233
else:
33-
return counts2pages(counts[2])
34+
return (count(counts[2]))/51 + 1
3435

3536
def get_follow_lists(url,person,boo,pages = 1):
3637
# 组url
@@ -39,8 +40,6 @@ def get_follow_lists(url,person,boo,pages = 1):
3940
data = requests.get(true_url, headers=headers)
4041
soup = BeautifulSoup(data.text, 'lxml')
4142
lists = soup.select('div.d-table > div.d-table-cell > a.d-inline-block')
42-
if lists == []:
43-
print 'yaoxiugaiisgoon'
4443
for i in lists:
4544
result_lists.append(default_url+i.get('href'))
4645
print default_url+i.get('href')

‎zhihu/4zhihuImgs.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66
url = 'https://www.zhihu.com/question/47371654'
77

88
headers = {
9-
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36 Core/1.47.933.400 QQBrowser/9.4.8699.400',
10-
'Cookie':'' # your cookie hear
9+
'User-Agent':'', # your user-Agent here
10+
'Cookie':'' # your cookie here
1111
}
1212

1313
data = requests.get(url, headers=headers)
1414
soup = BeautifulSoup(data.text, 'lxml')
1515
imgs = soup.select('div.zm-editable-content > img')
1616

1717
img_link = []
18-
folder_path = 'E://python/4weeks/jiandan/zhihuluoliimg/'
18+
folder_path = 'E://python/4weeks/jiandan/zhihuimg/'
1919

2020
for i in imgs:
2121
img_link.append(i.get('data-actualsrc'))

0 commit comments

Comments
 (0)