How do I automate a video download with Selenium and Python (Meta Quest Store Trailer Download)

17 Views Asked by At

I am looking to automate the download of the .mp4 video from https://www.meta.com/en-gb/experiences/4979055762136823/ using python and the selenium package. I am able to pop up and play the video with

url = "https://www.meta.com/en-gb/experiences/4979055762136823/"
driver.get(url)
driver.find_element(By.CSS_SELECTOR,'#mdc-main-content > div > div > div > div > main > div > div > div > div._anfv._anfz._anfy').click()
time.sleep(2)
video = driver.find_element(By.CSS_SELECTOR,'#mdc-main-content > div > div > div > div > main > div > div > div > div._anfv._anfw._anfy > div._ane1 > div._ane2 > div._aneb > div:nth-child(2) > div > video > source').get_attribute('src')

I am also able to grab the src url but am unable to download using requests (getting HTTP Error 403: Forbidden), but I want to be able to click on the download button each time and then save the mp4 file via the browser, is this possible with selenium ?. enter image description here

Alternatively if I am able to download the src somehow. The src is https://scontent.oculuscdn.com/v/t64.7195-25/10000000_1333543020822103_5659386953994694484_n.mp4.

Thanks in advance.

0

There are 0 best solutions below