Recently a friend of mine noticed that I often open the first few Google results in tabs without looking at them first. Now I'd like to directly open the best Google results from the address bar. I know that it's possible to add custom search engines to the bar in the settings. However, how can I make Chrome open multiple tabs at once when using such a custom search engine?
You could perhaps run a webserver in the background which takes the query and passes it to a google "i'm feeling lucky" link. Opening more than one tab would obviously require you visting the website in chrome and explicitly allowing popups. To open the top 3(not only the first) search result, you will probably have to get the source code of the page(probably possible with either wget or links) and extract the search results from it. To only look for search results and avoid opening, say the gmail link, you may wish to filter out everything until the second hit of your search criteria.
Code for this would look something like this:
wget http://google.com/?q=$query -O $query.html l=grep -n $query | head -c 1 head -cv $l echo $source | grep '<a href=' for i in $l1 $l2 $l3; do google-chrome-unstable $i ;done
Note that my code is probably broken and I have no idea how to get the script to run without using command line, but maybe you could do it using a web2py server with the python system.os command.
Hope it helps
.g:nth-child(-n+4) is where you can set the number of tabs, in this case it's 5.
Unfortunately Google changes the DOM structure every once in a while, so you need to adjust the code. Most of the time it's only a minuscule changes, where you have to swap one selector for another.
You create this kind of bookmark by adding a new bookmark and past this code as the "URL". Voilà!