不工作

Gya*_*yan 10 ubuntu

在Ubuntu上,我正在尝试使用wget下载文件(从脚本中).构建程序以每天下载此文件并加载到hadoop集群.

但是,wget失败,并显示以下消息.

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.
Run Code Online (Sandbox Code Playgroud)

当我在firefox或同等版本中尝试相同的url时,它工作得很好.是的,没有涉及许可协议的事情......

我错过了关于wget的基本内容吗?

end*_*ill 13

该站点阻止了wget,因为wget默认使用不常见的用户代理.要在wget中使用其他用户代理,请尝试:

wget -U Mozilla/5.0 http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
Run Code Online (Sandbox Code Playgroud)

  • @ learn4living,要在单个wget命令中下载多个URL,我通常会做`wget -U Mozilla/5.0"http://www.example.com/file1.zip""http://www.example.com/file2 .ZIP"` (2认同)

Zag*_*rax 6

使用:

wget -U mozilla http://www.nseindia.com/content/historical/EQUITIES/2012/JUN/cm15JUN2012bhav.csv.zip
Run Code Online (Sandbox Code Playgroud)

有些网站只是阻止wget用户代理下载文件.我刚用这个命令下载了该文件.有用.