我正在尝试获取此页上的视频链接https://in.news.yahoo.com/video/jitendra-singh-visits-manipur-militants-051500244.html。我尝试了多种方法使用硒,但没有成功。有人能指出我做错了什么吗
driver = webdriver.Chrome()
def getVideoTrend(self, "https://in.news.yahoo.com/video/jitendra-singh-visits-manipur-militants-051500244.html"):
driver.get(url)
element = WebDriverWait(driver, 10).until(lambda driver: driver.find_elements_by_class_name('mediavideoplayervppca'))
video_trend = []
#s = driver.find_element_by_css_selector('video.yvp-html5-video') #this also does not help
s = driver.find_elements_by_xpath('//*[@id="yui_3_9_1_1_1434089562443_964"]')
print s
print s.get_attribute('src')
请打开chrome中的链接以查看页面元素
在给定的URL中,你只有一个视频标签。所以您可以使用标记名来获取src。在
像这样:
相关问题 更多 >
编程相关推荐