문제

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...

도움이 되었습니까?

다른 팁

One workaround is to use the "start" parameter which still works and send multiple queries, but it's not very clean.

http://www.google.com/search?q=foobar&hl=en&num=20&start=0
http://www.google.com/search?q=foobar&hl=en&num=20&start=10
...

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 will also work.

For example: http://www.google.com/search?q=foobar&hl=en&num=20&complete=0

Refer to this webapps-link.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top