Paul
Paul

Reputation: 21985

Getting a cx ID for custom search, Google API - Python

How can I get a generic cx ID for using the custom search API in Python? http://code.google.com/p/google-api-python-client/source/browse/samples/customsearch/main.py

From what I have read I understand that this cx ID is for certain sites only(when creating a custom search engine it asks me for specific sites), but I want it to search on google, so I can get the first 3-5 results from a google-search.

So I want to search on GOOGLE using Custom Search API, I already got a Developer Key, I just need to find how can I get an cx ID for searching on google, not a personal site, or something like that.

Upvotes: 36

Views: 60133

Answers (5)

Masa
Masa

Reputation: 362

As of 2023

  1. Go to https://cse.google.com/all
  2. Click your search engine (ie. google)
  3. Copy the cx shown in the table. enter image description here

Upvotes: 1

name-it
name-it

Reputation: 2358

As of 2020

  1. Go to https://cse.google.com/all
  2. Select your search engine or Create one and go into that
  3. You can find the CX id titled as "Search engine ID"
  4. Public URL also has the cx id in the Query param as ?cx=**

2012 Answer outdated.

here you can find the cx id http://www.google.com/cse/manage/all. look for My search engines then choose from the list

Upvotes: 50

Paul
Paul

Reputation: 21985

Solved: Go to your

Custom Search Engine -> 
  Edit Search Engine -> 
    Basics -> 
      Sites to Search -> 
        select: Search the entire web 

but emphasize included sites.

Upvotes: 22

user4280261
user4280261

Reputation:

As of 2017 (this may be outdated in the future), here are the steps:

1) After getting the API key (under Custom Search API) here

2) Head to CSE home

3) Click on Add below Edit Search Engine

4) You'll get a search box, type in www.google.com and then click on Create at the bottom

5) You'll get your cx code (called Search Engine ID) to use with your API key

Upvotes: 24

Christian
Christian

Reputation: 17

On the Custom Search wizard,it's true that you will be asked to choose some sites, but you are allowed to use wild cards, so you can type *.edu, *.org, ... so your search can be very large!

I quote what the wizard tells me on URL's formatting (sorry , in french!):
"Formatage des URL

Pages individuelles : si vous indiquez www.mysite.com/mypage.html, seule la page mypage.html est incluse sur www.mysite.com.
Sites entiers : si vous indiquez www.mysite.com/*, toutes les pages de www.mysite.com sont incluses.
Parties de sites : vous pouvez utiliser des caractères génériques pour inclure uniquement certaines parties d'un site. Par exemple, www.mysite.com/*about* permet d'inclure uniquement les fichiers sur www.mysite.com contenant about dans leur nom.
Domaines entiers : vous pouvez également spécifier un domaine entier en utilisant *.mydomain.com. Si vous indiquez mydomain.com, le système le convertit automatiquement en *.mydomain.com/*. Si ce n'est pas ce que vous voulez, vous pouvez revenir en arrière dans le panneau de configuration.

Upvotes: 0

Related Questions