google custom search api 申请注册 cx key

本文档详细介绍了如何建立和使用谷歌自定义搜索引擎(CustomSearchEngine),包括获取APIkey,设置搜索参数,以及进行搜索测试。通过指定的搜索参数如key、cx和q,可以在应用程序中集成API进行搜索。同时,列出了各种搜索参数选项,如c2coff、cr、cx等,以定制化搜索需求。

目录

1.建立Custom Search Engine

2.到API key网站 获取 api key

3.测试 api key 搜索

4.搜索参数列表


1.建立Custom Search Engine

得到search engine ID,必须先建立 Custom Search Engine。

我们连到Custom Search Engine control panel 建立Search Engine。

https://cse.google.com/cse/all

https://ithelp.ithome.com.tw/upload/images/20191002/20112182dNLjRH1S9x.jpg

取得Search Engine ID , 把值复制下来

https://ithelp.ithome.com.tw/upload/images/20191003/201121829KqU5grMDU.jpg

 

2.到API key网站 获取 api key

https://developers.google.com/custom-search/v1/overview

https://ithelp.ithome.com.tw/upload/images/20191002/201121829e8XOtVVWY.jpg

取得API key

https://ithelp.ithome.com.tw/upload/images/20191002/20112182N3h97G8NBS.jpg

https://ithelp.ithome.com.tw/upload/images/20191003/20112182QRTLnS2xQ3.jpg

3.测试 api key 搜索

有了search engine ID & API key,我们将可采用以下网址搜寻Google 上丰富资料。

网址至少要包含以下三个参数:

key: API key

cx: search engine ID

q: 搜寻的文字

接下来我们就可以在浏览器输入要查询的资料,之后就可以在App中放入查询的API

get 搜索 实例:

https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures

其中 INSERT_YOUR_API_KEY 换成自己 api key

https://ithelp.ithome.com.tw/upload/images/20191003/20112182xa7YuJlBLM.jpg

4.搜索参数列表

原文链接:https://developers.google.com/custom-search/v1/reference/rest/v1/cse/list

Parameters
c2coff

string

Enables or disables 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值