Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to write a function that, starting from a string, returns the Google search hits on that string (the format and other stuff, I still have to decide).

I have looked around and have found nothing that works (the wsdl-thing for Google search referenced by the docs, with WebServices, is retired and returns 404).

Any hints, except scraping the result page by hand?

share|improve this question
Have a look at this answer. Presumably, Google expects you to switch to a newer API. –  Leonid Shifrin Mar 2 '13 at 23:18
Take a look at this answer. You can use the same approach I show there, but that's a deprecated API as well. It works now, but it won't keep working for long. –  Szabolcs Mar 2 '13 at 23:27

1 Answer 1

up vote 7 down vote accepted

After looking better into the comment by Szabolcs, I have chosen this path (which I did try for images, but it didn't cross my mind to use it for web):

result = Import[ "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=furry%20beasts", "JSON"]

and then

"url" /. ("results" /. ("responseData" /. result))

to get the links to the pages. Or, to get the "preview" of the pages:

"content" /. ("results" /. ("responseData" /. result))

It works like a charm even if it is unsupported and bound to break at some point.

For reference: https://developers.google.com/web-search/docs/

share|improve this answer
I would advise setting the User agent string if you do this. –  William Nov 24 '13 at 4:20
@mgm How could we launch a browser from mma with a given url programatically? The front-end can do this already for hyperlinks... –  M.R. Apr 8 at 17:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.