I have a small utility that I use to download an MP3 file from a website on a schedule and then builds/updates a podcast XML file which I\'ve added to iTunes.
The te
Just for the sake of completeness, it is also possible to call any program for retrieving files using the subprocess
package. Programs dedicated to retrieving files are more powerful than Python functions like urlretrieve
. For example, wget can download directories recursively (-R
), can deal with FTP, redirects, HTTP proxies, can avoid re-downloading existing files (-nc
), and aria2 can do multi-connection downloads which can potentially speed up your downloads.
import subprocess
subprocess.check_output(['wget', '-O', 'example_output_file.html', 'https://example.com'])
In Jupyter Notebook, one can also call programs directly with the !
syntax:
!wget -O example_output_file.html https://example.com