简要描述:
- Google自定义搜索,为用户提供站内自定义搜索。并提供接口支持,在用户的应用中进行调用,完成站内的搜索过功能。其特点:使用简单,尤其对应用开发人员,无需关心搜索的具体实现。目前Customer Search支持企业级应用,也支持个人应用。
使用步骤:
- 在google的API管理器申请Custom Search API的API密钥,以启用和创建你的凭据,网址:
https://console.developers.google.com/apis/dashboard?project=bbs-india - 配置你的自定义搜索引擎,网址:
https://cse.google.com/cse/all - 输入关键词进行搜索,包括API方式、公开网址方式
公开网址方式返回示例
API接口方式返回搜索结果示例
{
cursor: {
currentPageIndex: 0,
estimatedResultCount: "255",
moreResultsUrl: "http://www.google.com/cse?oe=utf8&ie=utf8&source=uds&q=123&start=0&cx=016402243527693484754:z8bxbefof6o",
resultCount: "255",
searchResultTime: "0.21",
pages: [
{
label: 1,
start: "0"
},
{
label: 2,
start: "2"
},
{
label: 3,
start: "4"
},
{
label: 4,
start: "6"
},
{
label: 5,
start: "8"
},
{
label: 6,
start: "10"
},
{
label: 7,
start: "12"
},
{
label: 8,
start: "14"
},
{
label: 9,
start: "16"
},
{
label: 10,
start: "18"
}
]
},
context: {
title: "c.mi.com",
total_results: "64",
facets: [
]
},
results: [
{
GsearchResultClass: "GwebSearch",
cacheUrl: "http://www.google.com/search?q=cache:Ry2YgNocTkEJ:c.mi.com",
clicktrackUrl: "https://www.google.com/url?q=http://c.mi.com/in/space-uid-534194697.html&sa=U&ved=0ahUKEwi_6bvGlKTOAhUH_WMKHVA-AxIQFggEMAA&client=internal-uds-cse&usg=AFQjCNGE3VOe4N36-OZxOg-Cw-IXKUigAg",
content: "Rajesh <b>123</b> Profile ,Mi Community. ... Profile. ID: 534194697. Nickname: Rajesh <b>123</b>. Status: Offline. Gender: Secret. Day of birth: - ...",
contentNoFormatting: "Rajesh 123 Profile ,Mi Community. ... Profile. ID: 534194697. Nickname: Rajesh 123. Status: Offline. Gender: Secret. Day of birth: - ...",
formattedUrl: "c.mi.com/in/space-uid-534194697.html",
title: "Rajesh <b>123</b> Profile - Mi Community",
titleNoFormatting: "Rajesh 123 Profile - Mi Community",
unescapedUrl: "http://c.mi.com/in/space-uid-534194697.html",
url: "http://c.mi.com/in/space-uid-534194697.html",
visibleUrl: "c.mi.com",
richSnippet: {
metatags: {
applicationName: "Mi Community",
msapplicationTooltip: "Mi Community",
msapplicationTask: "name=Forum;action-uri=http://c.mi.com/in/forum.php;icon-uri=http://c.mi.com/in/http://bbs.appmifile.com/in/static/image/common/bbs.ico"
}
}
},
{
GsearchResultClass: "GwebSearch",
cacheUrl: "http://www.google.com/search?q=cache:5s2uT8-PeLYJ:c.mi.com",
clicktrackUrl: "https://www.google.com/url?q=http://c.mi.com/in/space-uid-1544909598.html&sa=U&ved=0ahUKEwi_6bvGlKTOAhUH_WMKHVA-AxIQFggGMAE&client=internal-uds-cse&usg=AFQjCNFy5-U3EsLYAVTMLO-7iEXMSuHXjg",
content: "ID: 1544909598. Nickname: Arijit <b>Kundu123</b>. Status: Offline. Real Name: Arijit Kundu. Gender: Male. Education degree: Bachelor. Interests: Playing Pc games.",
contentNoFormatting: "ID: 1544909598. Nickname: Arijit Kundu123. Status: Offline. Real Name: Arijit Kundu. Gender: Male. Education degree: Bachelor. Interests: Playing Pc games.",
formattedUrl: "c.mi.com/in/space-uid-1544909598.html",
title: "Arijit <b>Kundu123</b> Profile - Mi Community",
titleNoFormatting: "Arijit Kundu123 Profile - Mi Community",
unescapedUrl: "http://c.mi.com/in/space-uid-1544909598.html",
url: "http://c.mi.com/in/space-uid-1544909598.html",
visibleUrl: "c.mi.com",
richSnippet: {
metatags: {
applicationName: "Mi Community",
msapplicationTooltip: "Mi Community",
msapplicationTask: "name=Forum;action-uri=http://c.mi.com/in/forum.php;icon-uri=http://c.mi.com/in/http://bbs.appmifile.com/in/static/image/common/bbs.ico"
}
}
}
]
}
返回参数说明
|参数名|说明|
|:----- |:-----|----- |
|pages| 分页信息,展示在页脚 |
|results| 搜索到的items |
网友评论