爬取b站首页的 导航里的标题字 。练习 ,为啥有的‘’‘’‘"番剧”等词爬不下来?
import requests
from bs4
import BeautifulSoup
url
= 'https://www.bilibili.com/'
response
= requests
.get
(url
)
html
= response
.text
soup
= BeautifulSoup
(html
,'html.parser')
datas2
= soup
.find
('div',class_
="channel-menu-itnl report-wrap-module")
for i
in datas2
:
tou_name
= i
.find
(class_
="name").text
print(tou_name
)
转载请注明原文地址:https://tech.qufami.com/read-8160.html