Download files with wget from sites that verify your user-agent
You want to download a file from a given site with your favourite wget utility but you get a “
403 Forbidden” error in your face. Of course, everything works from your browser. What to do?
If it works from the browser but it fails with wget, then the site must check your user-agent. If it sees “
User-Agent: Wget/1.12 (linux-gnu)” (version may vary), then it simply blocks you.
But don’t fear for a second. Simply fake a different user agent with wget and continue downloading.
wget --user-agent "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0" http://host/file.jpg
If you don’t want to provide a user agent each time, put the following your
# custom .wgetrc file user_agent = Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0