标签: google-custom-search

使用Google自定义搜索API时,"每日限制超出"

我想抓取200个结果大约2000个查询,但它给了我"超出每日限制"的错误.

我想确认每天可以抓取多少结果.有没有解决方案可以解决这个问题?或者唯一的方法是每天抓取一小部分查询......?

我抓取谷歌的代码如下:

def crawl(query_list):
    http = httplib2.Http()

    # Construct the service object for the interacting with the CustomSearch API.
    service = discovery.build('customsearch', 'v1',  developerKey='my api key', http=http)

    res_list = []
    for query in query_list:
        json_res = service.cse().list(q = query, cx = 'my search engine id', num = 200,).execute()
        res_list.append(json_res)
Run Code Online (Sandbox Code Playgroud)

谢谢!

python google-custom-search google-api-python-client

8
推荐指数
1
解决办法
1万
查看次数

Google自定义搜索图片返回500错误

大约40小时前开始,用于图片搜索的Google自定义搜索(searchType = image)始终返回500错误.我已经仔细检查了API文档,似乎没有任何变化.正如你在这个论坛中看到的那样,这影响了很多人.

https://productforums.google.com/forum/#!category-topic/customsearch/troubleshooting-and-bugs/4bJPzGPLYfw

这是我回复的全部内容:

{
   "error": {
       "code": 500,
       "message": null
   }
}
Run Code Online (Sandbox Code Playgroud)

我曾试图打电话给Google,但他们只是将我重定向到了绝对没有相关信息的网站.

有没有人设法让这个工作或与谷歌的人交谈过?我们正在大量使用这个功能,并且长期使用这个功能非常昂贵.

search-engine google-custom-search web google-image-search

8
推荐指数
1
解决办法
1383
查看次数

无法在Google自定义搜索API上获得超过100个结果的结果

我需要使用Google自定义搜索API https://developers.google.com/custom-search/v1/overview.从那页开始,它说:

对于CSE用户,API每天免费提供100个搜索查询.如果您需要更多,可以在开发人员控制台中注册以进行结算.额外请求每1000次查询需要花费5美元,每天最多10k次查询.

我已经在开发者控制台内注册了结算信息.但是,我仍然无法检索超过100的结果.我还应该做些什么?https://www.googleapis.com/customsearch/v1?cx=CSE_INSTANCE&key=API_KEY&q=QUERY&start=100

{error:{errors:[{domain:"global",reason:"invalid",message:"Invalid Value"}],代码:400,消息:"Invalid Value"}}

search-engine google-api google-custom-search

8
推荐指数
1
解决办法
5626
查看次数

在建议文本上单击,在搜索框上添加建议文本(示例(显示youtube的结果))

所以在我的网站上我使用谷歌自定义搜索引擎,当我搜索示例'youtub'而不是'youtube'it显示为一个建议(显示结果为youtube - 搜索而不是youtub)或(你的意思是:youtube)

图片

所以当我点击文本youtube时,我想将它添加到我的搜索框中,我该怎么做?这是我的代码

searchbox .html

<form action="" method="GET" id="searchform">
<input required="" type="search" name="q" id="searchbox" placeholder="Search..." title="Search..." enableAutoComplete="true" autofocus/>
<button><div class="Search-Button"><img src="MYIMGHERE" class="search-png"/></div></button>
</form>
Run Code Online (Sandbox Code Playgroud)

.js文件

<script type="text/javascript">
(function() {
var cx = '007072537540236505002:fsvzbpwgtgc';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
var urlParams = new URLSearchParams(window.location.search);
document.getElementById('searchbox').value = urlParams.get('q');
</script>

<gcse:searchresults-only linktarget="_self"></gcse:searchresults-only>
Run Code Online (Sandbox Code Playgroud)

我的问题不是很明确,因为我找不到合适的词语!我很抱歉.

html javascript google-custom-search

8
推荐指数
1
解决办法
269
查看次数

如何在google自定义搜索API中的siteSearch上指定多个值?

我正在使用谷歌自定义搜索API并希望使用siteSearch创建搜索:

https://www.googleapis.com/customsearch/v1?key=k&cx=cx&q=cocos2d&siteSearch=www.cocos2d-iphone.org&siteSearchFilter=i

and it works fine (returns all the result only from the given site).

Then I want to specify TWO sites to search so I tried to change the :
siteSearch=www.cocos2d-iphone.org

to 
siteSearch=www.cocos2d-iphone.org www.XXXXXXXX.org
siteSearch=www.cocos2d-iphone.org|www.XXXXXXXX.org
siteSearch=www.cocos2d-iphone.org||www.XXXXXXXX.org

but none of these works.

hope someone can help here, thanks:)
Run Code Online (Sandbox Code Playgroud)

google-custom-search

7
推荐指数
1
解决办法
2238
查看次数

是否有 Google 自定义搜索休息 API 的工作示例?

我需要创建一个自动执行 Google 搜索的屏幕。我知道 JavaScript 并且我正在努力让 GSE 工作。

我有一个搜索引擎和一个 API 密钥。问题是谷歌的文档是循环的,即页面相互指向。我没有可以开始研究的工作样本。

如果您知道工作示例,请帮助。

我读过的文件是:

  1. cselement-devguide
  2. 介绍

google-custom-search

7
推荐指数
1
解决办法
2万
查看次数

在Google自定义搜索中强制逐字模式

是否可以强制Google自定义搜索使用默认的逐字模式?

出于我使用它的目的,逐字模式将产生最相关的结果,但用户可能不知道将他们的搜索放在引号中.

我有一个想法,我应该能够在将字符串提交给Google之前使用Javascript添加引号,但我无法弄清楚如何.

任何帮助将非常感激!

google-custom-search

7
推荐指数
1
解决办法
816
查看次数

如何在json数组中获取谷歌自定义搜索结果

我想在谷歌最新的自定义搜索中以 json 数组的形式获得谷歌搜索结果。

如何实现代码。

例如 :

 {
    "responseData": {` `
        "results": [
            {
      ` `          "GsearchResultClass ": "GwebSearch",
                "unescapedUrl": "http:/ / en.wikipedia.org/wiki/Paris_Hilton",
                "url"   : "http    ://    en.wikipedi a.org/wiki/Paris_Hilton",
                "visibleUrl  "  : "en.wikipedia .org",
                "cacheUrl    "    : "http://www.google.com/search?q=cache:TwrPfhd22hYJ:en.wikipedia.org",
                "title": "<   b>Paris Hilton</b   > - Wikipedia, the free encyclopedia",
                "titleNoFormatting": "Paris Hilton - Wikipedia, the free encyclopedia",
                "content": "[1] In 2006, she released her debut album..."
            },
            {
                "GsearchResultClass": "GwebSearch",
                "unescapedUrl": "http://`   `www.imdb.com/name/nm0385296/",
                "url": "http://`    `www.imdb.com/name/nm0385296/",
                "visibleUrl":     "www.imdb.com",
                "cacheUrl":      "http://www.google.com/search?q=cache:1i34KkqnsooJ:www.imdb.com",
                "title": "<b> …
Run Code Online (Sandbox Code Playgroud)

android json google-custom-search

7
推荐指数
1
解决办法
8613
查看次数

Google Custom Search API中的保留字词

我正在使用Google Search API,但我遇到了一些麻烦.这个请求(在Python中,使用请求库)工作正常

res = requests.get("https://www.googleapis.com/customsearch/v1", params={
    "cx": <key1>,
    "key": <key2>,
    "alt": "json",
    "num": 2,
    "q": "cat sock ship hero monkey baby match"
})
Run Code Online (Sandbox Code Playgroud)

并根据文档返回带有语法的结果

但是,此请求不起作用:

res = requests.get("https://www.googleapis.com/customsearch/v1", params={
    "cx": <key1>,
    "key": <key2>,
    "alt": "json",
    "num": 2,
    "q": "cat sock ship hero monkey footnoteref baby match"
})
Run Code Online (Sandbox Code Playgroud)

它返回:

{'kind': 'customsearch#search',
 'queries': {'request': [{'count': 2,
    'cx': '<key>',
    'inputEncoding': 'utf8',
    'outputEncoding': 'utf8',
    'safe': 'off',
    'searchTerms': 'cat sock ship hero monkey baby footnoteref match',
    'title': 'Google Custom Search - cat …
Run Code Online (Sandbox Code Playgroud)

google-custom-search

7
推荐指数
1
解决办法
334
查看次数

显示单页Google自定义搜索的多个结果

我有单页应用程序,我想在其中应用Google自定义搜索.当我搜索某些内容时,我的要求是什么,然后它将显示页面每个部分的结果.我创建了锚标记链接,只要点击它们就会将我重定向到页面的那个部分.

到目前为止我尝试使用来自创建搜索引擎的代码是我的代码:

(function() {
    var cx = 'xxxxxxxxxxxxxxxx:xxxxxxxxxx'; //my engine id
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
})();
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

google-search-api google-custom-search

7
推荐指数
0
解决办法
101
查看次数