我正在开发 OS X Yosemite 10.10.2。我想使用 curl 命令下载 ffmpeg-2.7.tar.bz2,如下所示:
它行不通。
但是它适用于其他网址。
添加时提示如下--详细 选项:
$ curl --verbose -O http://ffmpeg.org/releases/ffmpeg-2.7.tar.bz2
* Hostname was NOT found in DNS cache
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 192.190.173.55...
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to ffmpeg.org (192.190.173.55) port 80 (#0)
> GET /releases/ffmpeg-2.7.tar.bz2 HTTP/1.1
> User-Agent: curl/7.37.1
> Host: ffmpeg.org
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 302 Found
< Location: http://211.167.105.70:80/1Q2W3E4R5T6Y7U8I9O0P1Z2X3C4V5B/ffmpeg.org/releases/ffmpeg-2.7.tar.bz2
< Connection: Close
<
{ [data not shown]
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
* Closing connection 0
我哪里做错了?
PS:
$ curl --version
curl 7.37.1 (x86_64-apple-darwin14.0) libcurl/7.37.1 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz
最佳答案
您似乎正在使用代理 ( 211.167.105.70:80
),它返回 302 redirect .
要使 curl 遵循 HTTP 重定向,请使用 --location
选项:
curl --verbose --location -O http://ffmpeg.org/releases/ffmpeg-2.7.tar.bz2
关于curl - 为什么 curl 不能下载 ffmpeg-2.7.tar.bz2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30786023/