4

I am writing in Python a module that will query Google's Custom Search API and return all listings of domain 'example.com'

I Have been reading instructions at https://code.google.com/apis/customsearch/v1/getting_started.html and am a little stumped at the moment.

Are my assumptions listed below correct?

For example, to search for results that has 'example.com' in the URL, the query is:

*'https://www.googleapis.com/customsearch/v1?key=my_key&cx=017576662512468239146:omuauf_lfve&q=site:example.com'*

*key=my_key:* value of key given by google

cx=017576662512468239146: name of the search engine (google)? Is this correct?

*omuauf_lfve:* I have no idea what this is

q=site:example.com: This should return all results with 'example.com'; e.g. www.a.example.com, b.example.com, example .com

1
  • I'm getting 0 results, are you having the same issue ? Please let me know your solution. Commented Jun 28, 2013 at 1:50

1 Answer 1

5

Though this question is quite old and the author doesn't seem to be too responsive, Google still highly ranks this page and many people may come here, so I post my answer.

Searching with Google Custom Search is described in this answer to similar question.

Parameters are as follows:

key - yes, it is API key for your Google account. To obtain it go to APIs console, switch on Custom Search API on Services tab and find actual API key on API Access tab.

cx - yes again, it is search engine unique code. Note, that this code is of form "123456:abcdef", so "omuauf_lfve" is part of this code, not the other param.

q - actual search query. "site:example.com" is part of Google's query language. See search tips for details.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried the same and it returned me 0 results, is it because site: is not allowed, because no-where I find not to use it.
This is very related, have any of you guys know how to do it? @ffriend

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.