Wget 将我的 URL 地址的某些部分识别为语法错误

发布于 2024-10-31 09:05:53 字数 422 浏览 9 评论 0原文

我对 wget 还很陌生,我已经在 Google 上进行了研究,但没有找到任何线索。

我需要保存网页的单个 HTML 文件:

wget yahoo.com -O test.html

它可以工作,但是,当我尝试更具体时:

wget http://search.yahoo.com/404handler?src=search&p=food+delicious -O test.html

问题来了,wget 识别 &p=food+delicious 作为一种语法,它说:'p' 未被识别为内部或外部命令

我该如何解决这个问题?我非常感谢您的建议。

I am quite new with wget and I have done my research on Google but I found no clue.

I need to save a single HTML file of a webpage:

wget yahoo.com -O test.html

and it works, but, when I try to be more specific:

wget http://search.yahoo.com/404handler?src=search&p=food+delicious -O test.html

here comes the problem, wget recognizes &p=food+delicious as a syntax, it says: 'p' is not recognized as an internal or external command

How can I solve this problem? I really appreciate your suggestions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

天赋异禀 2024-11-07 09:05:53

& 在 shell 中具有特殊含义。使用 \ 转义或将 url 放在引号中以避免此问题。

wget http://search.yahoo.com/404handler?src=search\&p=food+delicious -O test.html

或者

wget "http://search.yahoo.com/404handler?src=search&p=food+delicious" -O test.html

在许多 Unix shell 中,在命令后面添加 & 会导致其变为 在后台执行

The & has a special meaning in the shell. Escape it with \ or put the url in quotes to avoid this problem.

wget http://search.yahoo.com/404handler?src=search\&p=food+delicious -O test.html

or

wget "http://search.yahoo.com/404handler?src=search&p=food+delicious" -O test.html

In many Unix shells, putting an & after a command causes it to be executed in the background.

鹊巢 2024-11-07 09:05:53

将 URL 用单引号引起来以避免此问题。

IE

wget 'http://search.yahoo.com/404handler?src=search&p=food+delicious' -O test.html

Wrap your URL in single quotes to avoid this issue.

i.e.

wget 'http://search.yahoo.com/404handler?src=search&p=food+delicious' -O test.html
愚人国度 2024-11-07 09:05:53

如果你使用的是 jubyter 笔记本,也许

pip install wget 

在从 URL 扭曲之前检查你是否已经下载

if you are using a jubyter notebook, maybe check if you have downloaded

pip install wget 

before warping from URL

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文