如何从 http url 查询中禁用 Google 即时搜索?
我的一些程序直接向 Google 发送查询,然后解析 HTML 结果 - 例如 http://www.google.com/search?q=foobar&hl=en&num=20。
不幸的是,似乎从最近开始,当向 Google 发送此类查询时,由于即时搜索,“num”参数被忽略。不管怎样,页面中只显示10条结果。如果禁用即时搜索,它会再次起作用。问题是设置存储在 cookie 或其他东西中,如果可能的话,从程序端预先设置是非常不切实际的。
有没有办法向查询添加额外的参数来绕过即时搜索并使“num”再次工作?我确信我不仅仅是一个解析 Google HTML 结果的人......
Some of my programs send direct queries to Google and then parse the HTML results - for instance http://www.google.com/search?q=foobar&hl=en&num=20.
Unfortunately, it seems that since very recently, when sending such queries to Google, the "num" parameter is ignored because of Instant Search. No matter what, only 10 results are shown in the page. If you disable Instant Search, then it works again. Problem is that settings is stored in a cookie or something and it's very impractical, if at all possible, to pre-set from the program side.
Is there a way to add an extra parameter to the query to bypass Instant Search and get "num" working again? I'm sure I'm not only one parsing Google HTML results...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
只需添加“&as_qdr=all”
http://www.google.com/search?q=foobar&hl=en&num=2&start=0&as_qdr=all
Just add "&as_qdr=all"
http://www.google.com/search?q=foobar&hl=en&num=2&start=0&as_qdr=all
一种解决方法是使用“start”参数,该参数仍然有效并发送多个查询,但它不是很干净。
One workaround is to use the "start" parameter which still works and send multiple queries, but it's not very clean.
更多调查表明,这个“错误”似乎只发生在 Web 浏览器中,而不是在使用不提供用户代理的 HTTP 客户端时发生。
所以说到底事情还是好的!
More investigation shows that this "bug" seems to only happen for web browsers, not when using HTTP clients that don't provide a user agent.
So things are still good after all!
&complete=0
也可以工作。例如:
http://www.google.com/ search?q=foobar&hl=en&num=20&complete=0
请参阅此网络应用程序链接。
&complete=0
will also work.For example:
http://www.google.com/search?q=foobar&hl=en&num=20&complete=0
Refer to this webapps-link.