Estoy usando selenio. Como resultado, después de ejecutar el código, dice archivo no encontrado. ¿Alguien podría ayudarme?
def get_https(controlador, uri):
blob_script=""" console.log(arguments); var uri = arguments[0]; var xhr = new XMLHttpRequest(); xhr.responseType = "blob"; xhr.open("GET", uri, true); xhr.send(); """ print("execute_async_script -> "+uri) result = driver.execute_async_script(blob_script,uri) print('result = ' + str(result)) return resultdef scrape_video_link(controlador):
body = driver.find_element_by_tag_name('body') scrolling=True while scrolling: body.send_keys(Keys.PAGE_DOWN) time.sleep(1) try: image_element = body.find_elements_by_css_selector('div[data-testid="videoPlayer"]') for video_div in image_element: href = video_div.find_element_by_tag_name("video").get_attribute("src") return href except Exception as ex: print("Error video not contain")def principal():
name='BallySportWest' url="https://twitter.com/"+name driver.get(url) time.sleep(2) href=scrape_video_link(driver) bytes = get_https(driver,href)