从谷歌api获取innacurate谷歌搜索结果

时间:2022-08-22 10:23:39

What do I have?

我有什么?

  • Google Account.
  • 谷歌账户。
  • Simple API Key access.
  • 简单的API键访问。
  • I have created a Custom Search Engine, I've set Search the entire web but emphasize included sites in it, and I have removed all the links from Sites to search section (so that it searched the entire web, and it's not restricted to a certain website).
  • 我创建了一个自定义搜索引擎,我设置了搜索整个web,但强调了其中包含的站点,我还删除了从站点到搜索部分的所有链接(这样它就可以搜索整个web,而不局限于特定的站点)。
  • From the Custom Search Engine I got CX (search engine ID).
  • 从自定义搜索引擎我得到了CX(搜索引擎ID)。

If I try this command:

如果我尝试这个命令:

https://www.googleapis.com/customsearch/v1?key=[MY_API_KEY]&cx=017576662512468239146:omuauf_lfve&q=intitle:%22crazy+stink%22

(the CX is provided by google as an example here: https://developers.google.com/custom-search/json-api/v1/using_rest, but I get the same results if I set my own CX).

(这里谷歌提供了CX示例:https://developers.google.com/custom-search/json-api/v1/using_rest,但是如果我设置自己的CX,会得到相同的结果)。

Results:

结果:

{
 "kind": "customsearch#search",
 "url": {
  "type": "application/json",
  "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
 },
 "queries": {
  "request": [
   {
    "title": "Google Custom Search - intitle:\"crazy stink\"",
    "totalResults": "0",
    "searchTerms": "intitle:\"crazy stink\"",
    "count": 10,
    "inputEncoding": "utf8",
    "outputEncoding": "utf8",
    "safe": "off",
    "cx": "017576662512468239146:omuauf_lfve"
   }
  ]
 },
 "searchInformation": {
  "searchTime": 0.35068,
  "formattedSearchTime": "0.35",
  "totalResults": "0",
  "formattedTotalResults": "0"
 }
}

If you test this out, you can see that this will give you 0 results, however if you perform a Google search for the same query, you'll get approx. 35 results: https://www.google.com/search?q=intitle%3A%22crazy+stink%22

如果您测试它,您可以看到这将会给您0个结果,但是如果您对相同的查询执行谷歌搜索,您将会得到approx。35个结果:https://www.google.com/search?q=intitle%3A%22crazy +臭% 22

This is the main reason why I'm asking for assistance. In my project I need all of these results, if normal Google search gives 35 results, I need to get these 35 results as well.

这是我寻求帮助的主要原因。在我的项目中,我需要所有这些结果,如果正常的谷歌搜索得到35个结果,我也需要得到这35个结果。

I need this for my C# project, however I don't really care in which format do I get the results (JSON, XML, etc...)

我的c#项目需要这个,但是我并不关心以哪种格式获得结果(JSON、XML等等)。

I plan on enabling billing feature, and exceeding the "Free" limitations of 100 queries/day I currently have. However before I do that I need to have fully functional facility (which I don't at the moment).

我计划启用计费功能,并超过目前每天100个查询的“免费”限制。但是在此之前,我需要有完全的功能(目前我还没有)。


An additional note: Even with the free AJAX Api: http://ajax.googleapis.com/ajax/services/search/web?v=1.0&start=1&rsz=large&q=intitle:%22crazy+stink%22 I get 0 results (you can test this one out without the API key). Results:

附加说明:即使使用免费的AJAX Api: http://ajax.googleapis.com/ajax/services/search/web?结果:

{"responseData": {"results":[],"cursor":{"moreResultsUrl":"http://www.google.com/search?oe\u003dutf8\u0026ie\u003dutf8\u0026source\u003duds\u0026start\u003d1\u0026hl\u003den\u0026q\u003dintitle:%22crazy+stink%22","searchResultTime":"0.10"}}, "responseDetails": null, "responseStatus": 200}

Any ideas, suggestions are more than welcome.

任何想法,建议都不受欢迎。

2 个解决方案

#1


1  

With this api https://developers.google.com/custom-search/json-api/v1/using_rest, You have to give some sites to search, If you didn't provide the sites to search here(https://www.google.com/cse/all), It will not show you the results. At least put one site to search, or many sites to search. Your wanted Google Web Search API has been officially deprecated as of November 1, 2010. https://developers.google.com/web-search/docs/ It only search entire web

有了这个api https://developers.google.com/custom-search/json-api/v1/using_rest,你必须给一些站点去搜索,如果你没有提供在这里搜索的站点(https://www.google.com/cse/all),它将不会显示结果。至少要搜索一个站点,或者搜索多个站点。到2010年11月1日为止,你想要的谷歌Web搜索API正式被弃用。它只搜索整个web

#2


0  

I also faced the same issue, after research i found that i didnt provide sites in search engine which i created so i provide www.google.com as a site in search engine page here is the link to add site in your search engine

我也面临同样的问题,经过研究,我发现我没有提供我创建的搜索引擎的网站,所以我提供www.google.com作为搜索引擎页面的一个站点,这是在你的搜索引擎中添加网站的链接。

https://www.google.com/cse/setup/basic?cx={your search engine id}

https://www.google.com/cse/setup/basic?残雪= {您的搜索引擎id }

after executing above link with your search engine id you will get your search engine page then go into "Basics" tab in which go into "site to search" section then Add site for me i used www.google.com

在使用搜索引擎id执行上述链接之后,你会得到你的搜索引擎页面,然后进入“基础”选项卡,进入“站点到搜索”部分,然后为我添加我使用的www.google.com网站

and my issue get resolved :)

我的问题得到了解决

#1


1  

With this api https://developers.google.com/custom-search/json-api/v1/using_rest, You have to give some sites to search, If you didn't provide the sites to search here(https://www.google.com/cse/all), It will not show you the results. At least put one site to search, or many sites to search. Your wanted Google Web Search API has been officially deprecated as of November 1, 2010. https://developers.google.com/web-search/docs/ It only search entire web

有了这个api https://developers.google.com/custom-search/json-api/v1/using_rest,你必须给一些站点去搜索,如果你没有提供在这里搜索的站点(https://www.google.com/cse/all),它将不会显示结果。至少要搜索一个站点,或者搜索多个站点。到2010年11月1日为止,你想要的谷歌Web搜索API正式被弃用。它只搜索整个web

#2


0  

I also faced the same issue, after research i found that i didnt provide sites in search engine which i created so i provide www.google.com as a site in search engine page here is the link to add site in your search engine

我也面临同样的问题,经过研究,我发现我没有提供我创建的搜索引擎的网站,所以我提供www.google.com作为搜索引擎页面的一个站点,这是在你的搜索引擎中添加网站的链接。

https://www.google.com/cse/setup/basic?cx={your search engine id}

https://www.google.com/cse/setup/basic?残雪= {您的搜索引擎id }

after executing above link with your search engine id you will get your search engine page then go into "Basics" tab in which go into "site to search" section then Add site for me i used www.google.com

在使用搜索引擎id执行上述链接之后,你会得到你的搜索引擎页面,然后进入“基础”选项卡,进入“站点到搜索”部分,然后为我添加我使用的www.google.com网站

and my issue get resolved :)

我的问题得到了解决