Super Nerdy Cool

My (technical) adventures through the professional world…
April 13, 2012

Use wget or curl to download files that require login

Some sites require a user to login or authenticate before a file could be downloaded. To do so with wget, make use of the --post-data and --save-cookies arguments as described here. We first have to view the source of the html file, determine the name of the variables to post, and pass these information onto the site via the wget. Once we have a cookie file that’s authenticated, we can use this cookie file via the --load-cookies argument to download our files.

Some sites will also not allow wget to download the files. To get around that, make use of the --user-agent argument as described here.

All this can also be done in curl.

Leave a Comment