Skip to content

Commit

Permalink
fix bilibili
Browse files Browse the repository at this point in the history
  • Loading branch information
kangvcar committed Oct 20, 2020
1 parent 2032e72 commit 6108f72
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Spiders/bilibili/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ def get_all_bili_history(self):
# history = {'all': []}
history = []
for page_num in range(self.MAX_PAGE):
time.sleep(0.6)

url = 'https://api.bilibili.com/x/v2/history?pn={pn}&ps={ps}&jsonp=jsonp'.format(pn=page_num, ps=self.PAGE_PER_NUM)
result = self.req_get(headers, url)
# print('page = {} code = {} datalen = {}'.format(page_num, result['code'], len(result['data'])))
print('爬取中...')
time.sleep(1)
# if len(result['data']) == 0:
if not result['data']:
print('爬取完成...')
break
# if page_num == 2:
# break
history.append(result)
return history

Expand Down

0 comments on commit 6108f72

Please sign in to comment.