I am using selenium. As result after running the code, it says file not found. Could you someone help me.
def get_https(driver, 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 result
def scrape_video_link(driver):
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 main():
name='BallySportWest'
url="https://twitter.com/"+name
driver.get(url)
time.sleep(2)
href=scrape_video_link(driver)
bytes = get_https(driver,href)