I understand how to call chrome with webbrowser to access a url, however, if that url led to a download, how would I automatically save the file to an assigned destination?
Here's what I have:
import webbrowser
import os
url = 'https://videos.com/test.mp4'
path = os.getcwd() + '/video.mp4'
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
file = webbrowser.get(chrome_path).open(url)
with open(path, "wb") as f:
f.write(file)
This wouldn't work as chrome asks for a destination when accessing the url, I would like for chrome to automatically save the file based on the inputs of python. I understand I can do this manually using chrome, however, I'll be downloading many videos, which is why I would like to save time.
Is there any solution here or is this not possible?