Google Search – Google’s I’m Feeling Lucky URL

google-search

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?

Best Answer

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);
    }
});