1234567891011121314151617181920 |
- import requests
- def get_one_page(keyword, page, date_begin, date_end, proxy_ip, cookie, user_agent):
- params = {
- 'q': f'{keyword}',
- 'xsort': 'hot',
- 'typeall': 1,
- 'suball': 1,
- 'timescope': 'custom:' + date_begin + ':' + date_end,
- 'Refer': 'g',
- 'page': page,
- }
- headers = {
- 'Cookie': cookie,
- 'User_Agent': user_agent
- }
- url = 'https://s.weibo.com/weibo?' # 请求api
- html = requests.get(url, params=params, headers=headers).content
- return html
|