我想抓取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)
谢谢!
大约40小时前开始,用于图片搜索的Google自定义搜索(searchType = image)始终返回500错误.我已经仔细检查了API文档,似乎没有任何变化.正如你在这个论坛中看到的那样,这影响了很多人.
这是我回复的全部内容:
{
"error": {
"code": 500,
"message": null
}
}
Run Code Online (Sandbox Code Playgroud)
我曾试图打电话给Google,但他们只是将我重定向到了绝对没有相关信息的网站.
有没有人设法让这个工作或与谷歌的人交谈过?我们正在大量使用这个功能,并且长期使用这个功能非常昂贵.
我需要使用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"}}
所以在我的网站上我使用谷歌自定义搜索引擎,当我搜索示例'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)
我的问题不是很明确,因为我找不到合适的词语!我很抱歉.
我正在使用谷歌自定义搜索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 搜索的屏幕。我知道 JavaScript 并且我正在努力让 GSE 工作。
我有一个搜索引擎和一个 API 密钥。问题是谷歌的文档是循环的,即页面相互指向。我没有可以开始研究的工作样本。
如果您知道工作示例,请帮助。
我读过的文件是:
是否可以强制Google自定义搜索使用默认的逐字模式?
出于我使用它的目的,逐字模式将产生最相关的结果,但用户可能不知道将他们的搜索放在引号中.
我有一个想法,我应该能够在将字符串提交给Google之前使用Javascript添加引号,但我无法弄清楚如何.
任何帮助将非常感激!
我想在谷歌最新的自定义搜索中以 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) 我正在使用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自定义搜索.当我搜索某些内容时,我的要求是什么,然后它将显示页面每个部分的结果.我创建了锚标记链接,只要点击它们就会将我重定向到页面的那个部分.
到目前为止我尝试使用来自创建搜索引擎的代码是我的代码:
(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)
谢谢您的帮助!