gpt4 book ai didi

linux - wget 打破内容处置

转载 作者:太空狗 更新时间:2023-10-29 11:17:53 24 4
gpt4 key购买 nike

我正在尝试从以下网站下载通过 Content-Disposition:attachment 发送的 kml 文件:

http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia

在命令中使用 wget 和 curl:

wget --content-disposition http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia

curl -O -J -L http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia

但是,它没有保存正在传输的文件,而是只保存了 html 内容,并且在传输结束时卡住了。终端返回为:

$wget --content-disposition http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia
[1] 32260
[2] 32261
[3] 32262
work@Aspire-V3-471:~$ --2016-05-13 19:37:54-- http://waterwatch.usgs.gov/index.php?m=real
Resolving waterwatch.usgs.gov (waterwatch.usgs.gov)... 2001:49c8:0:126c::56, 137.227.242.56
Connecting to waterwatch.usgs.gov (waterwatch.usgs.gov)|2001:49c8:0:126c::56|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.php?m=real.5’

[ <=> ] 41.637 174KB/s in 0,2s

2016-05-13 19:37:55 (174 KB/s) - ‘index.php?m=real.5’ saved [41637]

他们收到消息了,我需要按 Ctrl+C。因为我得到的标题是

HTTP/1.1 200 OK
Date: Sat, 14 May 2016 00:19:21 GMT
Content-Disposition: attachment; filename="real_ia.kml"
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: application/vnd.google-earth.kml+xml
X-Frame-Options: SAMEORIGIN

我希望下载“real_ia.kml”文件。使用 curl 命令给出了类似的结果。

为什么会卡住,只下载 HTML 内容?

最佳答案

& 符号被解释为 shell 特殊字符,它导致命令在后台运行( fork )。所以你应该 escape or quote他们:

curl -O -J -L 'http://waterwatch.usgs.gov/index.php?m=real&w=kml&r=us&regions=ia'

在上面的命令中我们使用了full quoting .

输出中的以下几行意味着三个命令被 fork 到后台:

[1] 32260
[2] 32261
[3] 32262

左边(括号内)的数字是作业编号。您可以通过键入 fg N 将作业置于前台,其中 N 是作业的编号。右边的数字是进程 ID。

关于linux - wget 打破内容处置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37221310/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com