作为一个爬虫必须摸不一样的鱼,平常我们怎么看热榜,今天爬一个热榜数据,咱就在ied中读热榜。仍是一个乌龙事情听我细细道来网站地址
1,话不多说,今天图也不看了直接进入主题,翻开网站主页抓个包




headers = {
'Accept': 'application/json, text/javascript, */*; q=0.01',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Cookie': 'deviceId=web.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqaWQiOiJhNjNkZjYxZS00ODZhLTQzNTgtODNmMy1hNDlkMjdkMmI4ZmUiLCJleHBpcmUiOiIxNjY1MjIyMzY3MDAwIn0.eQF9za4cSq8huEESJPn0nDP3PUsDiVNZ4CM_fTAeWMg; Hm_lvt_03b2668f8e8699e91d479d62bc7630f1=1662630378',
'Pragma': 'no-cache',
'Referer': 'https://dig.chouti.com/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
}
import time
params = {
'afterTime': '1681236005077000',
'_': f'{int(time.time()*1000)}',
}
response = requests.get('https://dig.chouti.com/link/hot', params=params, headers=headers).json()['data']
next_afterTime = response[-1]['operateTime']
print(next_afterTime)
for res in response:
title = res['title']
url = res['url']
print(title)
yes = input()
if yes == '1':
print(url)
4,ok这样的话就只需要看到想看的标题就输入1返回url,就能够自行观赏了,跑一下
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。



