使用终端下载所有 ctrl alt del 网络漫画
我尝试使用以下命令来下载 ctrl alt del 漫画。
$ for filename in $(seq 20021023 20100503); do wget http://www.ctrlaltdel-online.com/comics/"$filename".jpg; done
我收到以下错误代码,bash:意外标记“do”附近的语法错误
我也尝试使用 cURL,使用此命令,
curl http://ctrlaltdel-online.com/comics[20021023..20100503].jpg
我收到以下错误代码,curl:(3 ) [globbing] 错误: pos 37 之后的范围规范错误
出了什么问题,如何修复它?
I've tried using the following commands to download the ctrl alt del comics.
$ for filename in $(seq 20021023 20100503); do wget http://www.ctrlaltdel-online.com/comics/"$filename".jpg; done
I get the following error code, bash: syntax error near unexpected token 'do'
I've also tried using cURL, using this command,
curl http://ctrlaltdel-online.com/comics[20021023..20100503].jpg
I get the following error code, curl: (3) [globbing] error: bad range specification after pos 37
What's wrong, and how can I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 MSW 指出的那样,抓取网站可能是非法的、不道德的、令作者恼怒的,也可能是完全正常的。请以负责任的方式使用您的脚本编写能力,并以公益为目的 (tm)。寻求许可肯定是一件好事。
请注意,ctrlaltdel-online.com Web 服务器似乎使用正常的 wget 用户代理字符串返回 HTTP 403 禁止 wget。模仿 Firefox 风格的东西似乎绕过了这一点(尽管我打赌他们只是明确拒绝 wget,这表明他们很可能禁止这种类型的访问)。
用更大的数字替换 365 可以追溯到一年多之前。 wget 输出可能很烦人,因此您可以传递 -q 使其安静。
As msw pointed out, crawling a site could be either illegal, unethical, irritating to the author, or perfectly fine. Please use your scripting powers responsibly and for Good (tm). Asking permission would certainly be a nice thing to do.
Note that the ctrlaltdel-online.com web server seems to return HTTP 403 forbidden to wget with the normal wget User-Agent string. Emulating something Firefox-ish seems to bypass that (although I bet they are just explicitly denying wget, which indicates they most likely forbid this type of access).
Replace 365 with a larger number to go back more than a year. The wget output might be annoying, so you can pass it -q to make it quiet.
我正在写同样的脚本。这里是。
i was writing the same script. Here it is.