开发者

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, n开发者_C百科ot a personal site, or something like that.


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


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


Solved: Go to your

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

but emphasize included sites.


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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜