Link Directly to Google’s “I’m Feeling Lucky” Feature
This post is part of a project to move my old reference material to my blog. Before 2012, when I accessed the same pieces of code or general information multiple times, I would write a quick HTML page for my own reference and put it on a personal site. Later, I published these pages online. Some of the pages still get used and now I want to make them available on my blog.
Photo by João Silas
Creating a link that uses the I’m Feeling Lucky feature enables you to link people directly to a page that can help them. In other words, you can simulate doing a Google search for the person and returning the top result.
The URL structure is:
The most important part of the URL is &btnI. If you omit it, Google just returns a regular results page. With &btnI appended to the end, Google takes you directly to the top result for the search term (which is, in this case, “term”).
Please note that the last letter is a capital “i”.
Using the Example Above
You can ask users which browser they are using in a text input. If the user inputs “firefox” and submits the form, you can have your app/page redirect to:
Similarly, if the user entered “Internet Explorer”, your form can redirect them to:
This seems to work for some queries, but not all. While, all of the examples in this post have worked so far, here’s an example of one that doesn’t work:
Instead of redirecting you to the first search result, the regular Google results are shown. I’m not sure why this is. Google doesn’t seem to have any documentation to support this API in the first place.
If you are running into this issue, Lorenzo Alali pointed me to this topic on the Alfred Forums where a workaround is discussed. DuckDuckGo (a competing search engine) provides the same functionality as Google’s “I’m Feeling Lucky” button. They call it “I’m Feeling Ducky”. Here’s how you would use it:
The difference between this approach and the Google approach is that:
You are harnessing the power of DuckDuckGo’s search instead of Google
It seems to work in cases where Google fails