14

I'm trying to make an URL that redirects me to the first result using the "I'm feeling lucky" feature, for this I add &btnI=I to the search url but sometimes it doesn't work, and shows me the results page instead, I tried searching for a solution and some were saying that by adding &sourceid=navclient to the URL it should work but it doesn't, for example:

this works:

http://www.google.com/search?&sourceid=navclient&btnI=I&q=facebook

but this doesn't:

http://www.google.com/search?&sourceid=navclient&btnI=I&q=cahuu

I think it depends of how unusual the query is, but I need to make it work with romanized Japanese so, how can I make it work for that situation?

11

After a while I found a solution; it’s possible to use:

http://www.google.com/webhp?#q=yourquery&btnI=I

It will always send you to the first result, but sometimes it will half render google.com before redirecting you.

Adding to this, my question was for using it in a Greasemonkey/Tampermonkey script and after studying how Google always redirected you if you used the "I'm feeling lucky" button on google.com I found It worked because the referer was "https://www.google.com/"; then you could use GM_xmlhttpRequest and finalUrl like this:

GM_xmlhttpRequest({
    method: 'HEAD',
    url: 'https://www.google.com/search?btnI=I&q=yourquery',
    headers: {
        referer: 'https://www.google.com/'
    },
    onload: function(response) {
        console.log(response.finalUrl);
    }
});
  • 1
    Nice answer, but it goes through two redirects for me. The following variant works without a redirect: google.com/webhp?#btnI=I&q=yourquery Note: stack exchange is wrongly shortening the URL, the host should be www.google.com – Sam Watkins Apr 29 '14 at 13:21
  • 1
    @SamWatkins, the order of GET parameters doesn't really make any difference. – lolmaus - Andrey Mikhaylov Sep 2 '14 at 9:00
  • The webhp URL does't work anymore. – orlp Jul 26 '15 at 22:41
  • 1
    As mentioned, this URL unfortunately doesn't seem to work anymore. It will just end up on a Google search result. – Philipp Lenssen Aug 22 '16 at 10:50
0

I get a "Did you mean" correction when using

http://www.google.com/search?&sourceid=navclient&btnI=I&q=cahuu

My guess is that you need a search query that is directly recognized by Google search with no ambiguity. The issue is, sometimes, instead of the "Did you mean", Google decides "Showing result for" something else, almost assuming that whatever you queried had a typo. In that case the "I'm feeling lucky" will send you to a page that may not contain your query at all. Here is an example:

http://www.google.com/search?&sourceid=navclient&btnI=I&q=gooogle

  • If you add &nfpr=1 to the URL you can avoid google showing the results for something that they think its correct, although it will still show you the "Did you mean" thing. Well then, it seems that there is no way to make it work for all querys. – user3035542 Dec 24 '13 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.