哔哩哔哩日榜前十

import requests
from bs4 import BeautifulSoup

url = "https://tophub.today/n/74KvxwokxM"
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"}


a=requests.get(url,headers=asd).content
b=a.decode('utf-8')  
c=re.compile(r'itemid="[0-9]*">(.*?)</a>') 
soup=BeautifulSoup(b,'html.parser')
num=re.compile(r'<td>(.*?)</td>')                
d=c.findall(b)[0:10]              
nums=num.findall(b)[0:10]            
e={"今日热榜":titles,"热度":nums}
h=pd.DataFrame(e)
print

猜你喜欢

转载自www.cnblogs.com/zhengquan123/p/12541477.html