0

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?

0

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

| improve this answer | |

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.