源代码
import requests
from bs4 import BeautifulSoup
import pandas as pd
url="https://tophub.today/n/Jb0vmloB1G"
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)Chrome/69.0.3497.100 Safari/537.36'}
html = r.text
r = requests.get(url)
r.encoding = r.apparent_encoding
soup=BeautifulSoup(html,'lxml')
list_1 = []
list_2 = []
for i in soup.find_all(class_="al"):
list_1.append(i.get_text().strip())
for l in soup.find_all(class_="table"):
list_2.append(l.get_text().strip())
data=[list_1,list_2]
print(data)
h=pd.DataFrame(data,index=["标题","热度"])
print(h.T)
结果