获取知乎的热点前十名的标题信息以及热度数据
作者:互联网
# coding: utf-8 import requests from bs4 import BeautifulSoup headers={"user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3741.400 QQBrowser/10.5.3863.400"} url='https://tophub.today/n/mproPpoq6O' resp=requests.get(url,headers=headers).content html=resp.decode('utf-8') soup=BeautifulSoup(html,'html.parser') a=soup.select('.jc tr') for i in a[0:10]: b=i.getText('\t') print(b)
标签:热度,soup,resp,html,BeautifulSoup,headers,537.36,知乎,前十名 来源: https://www.cnblogs.com/f-jp/p/12525868.html