- Python
B站爬虫
- 2024-1-13 20:11:21 @
from bs4 import BeautifulSoup # 导入bs4库
import requests # 发起网络请求
url="https://search.bilibili.com/all?vt=46273303&keyword=编程"
kv = {'user-agent': 'Mozilla/5.0'}
ress = requests.get(url, headers=kv)
ress.encoding = "utf-8"
res = BeautifulSoup(ress.text,"html.parser")
video = res.find(attrs={"class":"video-list row"})
for title in video.find_all(attrs={"class":"bili-video-card__info--tit"}):
text = title.get_text()
print(text,"\n")
0 条评论
目前还没有评论...