Chufesopo
2022-06-23T06:42:24+00:00
想通过[url]https://bilibili.iiilab.com/[/url]在pc端批量下载一些b站视频,用selenium去试了下,直接提示访问被拒了,不知道有无办法解决这个问题,路过的大佬帮看一下
代码如下:
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
# 打开浏览器
browser = webdriver.Chrome()
# 跳转到视频转换网站
browser.get("[url]https://bilibili.iiilab.com/")[/url]
# 找到输入框,输入b站连接并点击
browser.find_element_by_xpath('/html/body/div[2]/div/div/div[2]/input').send_keys('[url]https://www.bilibili.com/video/BV1QJ41137gj?p=5')[/url]
browser.find_element_by_xpath('/html/body/div[2]/div/div/div[2]/div/button').click()
sleep(2)
正常响应应该是这样的,弹出下载按钮,开始下载:
[img]https://img.nga.178.com/attachments/mon_202206/29/-7Q2q-g53yK2dT3cSsg-9q.jpg[/img]
结果确实这样的:
[img]https://img.nga.178.com/attachments/mon_202206/29/-7Q2q-74r8K26T3cSsg-8y.jpg[/img]
代码如下:
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
# 打开浏览器
browser = webdriver.Chrome()
# 跳转到视频转换网站
browser.get("[url]https://bilibili.iiilab.com/")[/url]
# 找到输入框,输入b站连接并点击
browser.find_element_by_xpath('/html/body/div[2]/div/div/div[2]/input').send_keys('[url]https://www.bilibili.com/video/BV1QJ41137gj?p=5')[/url]
browser.find_element_by_xpath('/html/body/div[2]/div/div/div[2]/div/button').click()
sleep(2)
正常响应应该是这样的,弹出下载按钮,开始下载:
[img]https://img.nga.178.com/attachments/mon_202206/29/-7Q2q-g53yK2dT3cSsg-9q.jpg[/img]
结果确实这样的:
[img]https://img.nga.178.com/attachments/mon_202206/29/-7Q2q-74r8K26T3cSsg-8y.jpg[/img]