|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
目标URL:https://www.bilibili.com/video/BV1LX4y157Rc
踩点如图所示
想爬取视频中的弹幕
写的代码如下- import requests as r
- import bs4 as b
- headers={"User-Agent":
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0"}
- url = 'https://www.bilibili.com/video/BV1LX4y157Rc'
- res = r.get(url, headers=headers)
- soup = b.BeautifulSoup(res.text, 'html.parser')
- danmu = soup.find_all('div', class_="billibilli-player-video-danmaku")
- for i in danmu:
- print(i.div.text)
-
复制代码
可为啥它什么都没出来,是不是我哪里做错了
|
-
踩点
|