How to download files from sites requiring authentication
Have you ever logged into a website that requires you login before you can download a file? Subsequently, a simple 'copy-link' option does not allow you to wget the file and a HTTP 403 Authorization Failed message is thrown. In order to get around this, I've used this method when a cookie for authentication is used:
- If not installed, download and install Chrome
- Download and install cookie.txt export from the Chrome Web Store
- Using Chrome, login to the site where you're attempting to wget or curl a file for download.
- Click on the cookie.txt export button next to the address bar in Chrome, and copy the contents into a file, such as cookies.txt
- ~# curl -L -b cookies.txt http://authreq.com/todownload/thisfile.iso -o name.iso
- -L follow redirects; -b use the cookie in specified file; -o write ouput to this local file
Comments are welcome on alternative ways using other web browsers.