12345678910111213141516171819202122232425 |
- import requests
- def get_one_page(keyword, page, date_begin, date_end, proxy_ip, cookie, user_agent):
- user = "lutingsong"
- password = "6cac3hci"
- proxie = {
- 'http': 'http://' + user + ':' + password + '@' + proxy_ip,
- 'https': 'https://' + user + ':' + password + '@' + proxy_ip
- }
- params = {
- 'q': f'{keyword}',
- '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
|