On Ubuntu, I am trying to download a file (from a script) using wget. Buildling a program to download this file everyday and load to a hadoop cluster.
however, the wget fails, with the following message.
wget http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
--2012-06-16 03:37:30-- http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
Resolving www.nseindia.com... 122.178.225.48, 122.178.225.18
Connecting to www.nseindia.com|122.178.225.48|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2012-06-16 03:37:30 ERROR 403: Forbidden.
when I try the same url in firefox or equivalent, it works just fine. And yes, there is no license agreement kind of thing involved...
Am I missing something basic regarding wget ??
If you get the -bash: wget: command not found error on Mac, Linux or Windows, it means that the wget GNU is either not installed or does not work properly. Go back and make sure that you installed wget properly.
Install wget command on Ubuntu After completing the install, again run the previous command to check the install version of this command. Run the wget command with –h option to display all option details of this command.
Installing Wget To check whether the Wget package is installed on your system, open up your console, type wget , and press enter. If you have wget installed, the system will print wget: missing URL . Otherwise, it will print wget command not found .
The site blocks wget because wget uses an uncommon user-agent by default. To use a different user-agent in wget, try:
wget -U Mozilla/5.0 http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
Use:
wget -U mozilla http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
Some sites simply prevent wget user-agent to download files. I just downloaded that file with this command. It works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With