4

Does google provide an API to access its search results?

The latest information I can find about this is based on this 2008 article which doesn't seem to exist anymore.

UPDATE

I do not want to be using Google custom search for my own site but rather access Google's results in the search engine results page naturally.

super9
  • 29,181
  • 39
  • 119
  • 172
  • 1
    @Nai Regarding your update, if you look at custom search you will see that it is an API for web search. Don't let the name confuse you. See my answer [here](http://stackoverflow.com/questions/4490983/google-search-with-python/4491058#4491058) for an example. – moinudin Dec 22 '10 at 22:26
  • @marcog Its not just the name but the description as well! " Google Custom Search enables you to search over a website or a collection of websites. You can harness the power of Google to create a search engine tailored to your needs and interests, and you can present the results in your website. Your custom search engine can prioritize or restrict search results based on websites you specify." Don't suppose you have an example in C# as well? :) – super9 Dec 23 '10 at 15:01
  • @Nai I don't know C#, but all you need is a module that can fetch a URL. The URL is independent of the language. – moinudin Dec 23 '10 at 15:03
  • @marcog Thanks anyway. I'm just gonna dive in and get busy. – super9 Dec 23 '10 at 15:05
  • @Nai This might help you: http://stackoverflow.com/questions/295557/c-downloading-a-url-with-timeout – moinudin Dec 23 '10 at 15:07
  • @marcog I've spend a couple of days looking at this but I can't seem to find the right URL to call to return google's natural search results? Do you happen to have the link that shows you how to construct the right URL? All the examples involve your own custom search engine as defined in the `&cx` and `&cref` parameters. – super9 Dec 26 '10 at 18:11
  • @Nai Perhaps my answer [here](http://stackoverflow.com/questions/4490983/google-search-with-python/4491058#4491058) helps? Just replace Python's `urllib2` module with the appropriate C# code. The URL remains the same. – moinudin Dec 26 '10 at 18:16
  • @marcog I've manage to do it using C# here http://stackoverflow.com/questions/4521239/deserializing-json-using-c. My problem is that the URL is using a defined cx value in the example `https://www.googleapis.com/customsearch/v1?key=YOUR_KEY_HERE&cx=017576662512468239146:omuauf_lfve&q=lectures` and is set to google's example. If you were to change the query parameters, you still get back computer engineering related results. – super9 Dec 26 '10 at 18:17
  • @marcog To get a `cx` value, you have to register specify what websites you want to be searching over. See here: http://www.google.com/cse/manage/create. The alternative is to use a cref value which doesnt give me what I want either. See here: http://www.google.com/cse/docs/cref.html. I dont think its possible to return organic results through this API unless Im missing something. – super9 Dec 26 '10 at 18:22
  • @Nai Read the [API docs](http://code.google.com/apis/customsearch/v1/overview.html). It worked just fine for me without either `cx` or `cref` parameters. – moinudin Dec 26 '10 at 18:28
  • @nai really? see this http://imgur.com/rtE84 – super9 Dec 26 '10 at 18:53

4 Answers4

1

Do you really need an API? If you just make a call to http://www.google.co.uk/search?q=testsearch for example it will return the results for 'testsearch'.

You haven't mentioned how you will be retrieving the results but you could use a webClient control in ASP.NET or something as simple as parsing the returned HTML.

m.edmondson
  • 30,382
  • 27
  • 123
  • 206
  • 3
    Careful with this one. You may be in violation of Google's terms of use. Also, Google may present a CAPCHA to your request if you send too many - http://www.google.com/support/websearch/bin/answer.py?hl=en&answer=86640. – dana Dec 22 '10 at 17:21
  • @dana - Good point. To be honest I've never had a need for a search API so far hence this was my best guess – m.edmondson Dec 22 '10 at 19:30
1

The original search API was deprecated in favour of the new custom search API. You can also find a lot of related info in the google-search-api tag which you even tagged this question with.

Community
  • 1
  • 1
moinudin
  • 134,091
  • 45
  • 190
  • 216
  • 4
    The custom search API *can* be used to search the whole web: http://www.google.com/support/customsearch/bin/answer.py?answer=1210656 – mattmanser Oct 07 '11 at 09:02
0

See: Google Search APIs

Specifically, you might be interested in this link:JSON/Atom Custom Search API

Scott
  • 13,735
  • 20
  • 94
  • 152
0

You can use the Custom Search API

THeis is the recommended replacement to the Web Search API which has been deprecated.

Matt Lacey
  • 65,560
  • 11
  • 91
  • 143