Page.py 542 B

1234567891011121314151617181920
  1. import requests
  2. def get_one_page(keyword, page, date_begin, date_end, proxy_ip, cookie, user_agent):
  3. params = {
  4. 'q': f'{keyword}',
  5. 'xsort': 'hot',
  6. 'typeall': 1,
  7. 'suball': 1,
  8. 'timescope': 'custom:' + date_begin + ':' + date_end,
  9. 'Refer': 'g',
  10. 'page': page,
  11. }
  12. headers = {
  13. 'Cookie': cookie,
  14. 'User_Agent': user_agent
  15. }
  16. url = 'https://s.weibo.com/weibo?' # 请求api
  17. html = requests.get(url, params=params, headers=headers).content
  18. return html