8

I'm creating a sample app that will take a query from user and will return the URL result returned from Google's "I'm Feeling Lucky" search. Does Google expose this functionality through their API? How to access this?

muraliv
  • 169
  • 1
  • 7

3 Answers3

5

It seems that Google change their I'm feeling lucky url.

A workaround is to use https://duckduckgo.com/?q=!ducky+github+foo+bar+foobar

https://duckduckgo.com/?q=!ducky+YOUR_URL_ENCODED_QUERY

kuzdu
  • 7,124
  • 1
  • 51
  • 69
4

There is nothing magic about Google's "I'm Feeling Lucky" functionality. It simply picks the first result of the search. So, however you're using the api, you can just select the first result as well.

Furthermore, you can use this format for a URL in order to hit the "I'm Feeling Lucky" result of Google:

http://www.google.com/search?q=my+keywords+for+search&btnI
Ben Reich
  • 16,222
  • 2
  • 38
  • 59
  • 1
    Unfortunately, 'btnI' is not working already, at least, for me. Correction: it works for some simple queries (term, term+term), but doesn't for some others (tsql+like). – tsul Mar 27 '18 at 09:45
  • See https://travishorn.com/link-directly-to-googles-i-m-feeling-lucky-feature-65ebe7b552bd – tsul Mar 27 '18 at 09:51
1

Deprecated You could use the Google API which is probably the best way to do it but will require more work api docs here https://developers.google.com/web-search/docs/

No longer working or you can go to this url with your seach query: http://www.google.com/webhp#q=your+search+query+here&btnI

be sure you add &btnI to the end otherwise it wont redirect


Update 2014

The above URL stopped working and yes the search API is depreciated, however there are always workaround. If you really have to you can still use a simple get request on the following URL:

https://www.google.com/search?q=your+search+query+here&btnI=

with of course your+search+query+here replaced with a URL encoded string.

Ben Reich
  • 16,222
  • 2
  • 38
  • 59
ug_
  • 11,267
  • 2
  • 35
  • 52