【发布时间】:2021-12-30 02:15:05
【问题描述】:
这是我要抓取的网站https://anime-hayai.com/play/30148/%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88-1-hd.html
我想从视频中抓取 scr='....' 数据,但它返回的是空字符串。
我的尝试
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get('https://anime-hayai.com/play/30148/%E0%B8%95%E0%B8%AD%E0%B8%99%E0%B8%97%E0%B8%B5%E0%B9%88-1-hd.html')
video = driver.find_element_by_xpath("//*[@id='player']/div[2]/div[4]/video").text
print(video)
它返回'' 空字符串。
我做错了吗? enter image description here 视频 scr 的预期结果
'https://stream.anime-hayai.com/videoplayback?id=6o7ov8-mxpu0aKZQYtLDpMuepaDas4tllm2jqqGUcqDE1c-j0pzahY1pxGuiaJhSteDG5NLdkaaVcotklmRye55ecaGWoJqio46hcs2XyKSmaKZQYqCXoovq'
【问题讨论】:
标签: jquery python-3.x selenium web-scraping iframe