我试图通过直接查询freebase的db来检索150个结果我正在传递我的API密钥,这是正常工作,我已经将google api控制台中的QPS限制提高到1000但是在重新审核图像时我重新阅读以下内容错误:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "userRateLimitExceededUnreg",
"message": "User Rate Limit Exceeded. Please sign up",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "User Rate Limit Exceeded. Please sign up"
}
}
有没有什么方法可以每隔1秒运行一次json查询十次,从而收到前100个结果? 这是我目前的所有Javascript(我假设可以写入较少的函数,但到目前为止这是用于测试目的):
/*autosuggest pre ouput*/
$(function() {
$("#myinput_one").suggest({
"filter": null,
"lang": "en",
"key" : "***",
"output": "(all)",
"limit": 5,
}).bind("fb-select", function(e, data) {$("#response1 pre").text(JSON.stringify(data, null, ' '));
prettyPrint();
$("#response1").show();
});
});
/*autosuggest & description*/
$(function() {
$("#myinput").suggest({
"filter": "(all type:/automotive/model)",
"lang": "en",
"key" : "***",
"output": "(description)",
}).bind("fb-select", function(e, data) {
$('#output').append("<li>" + data.name + "</li></li> " + data.output.description.wikipedia[0] + "</li>");
});
});
/*related search function*/
$(function() {
$("#myinput").change(function() {
var search_service = 'https://www.googleapis.com/freebase/v1/search';
var params = {
"filter": "(all type:/automotive/model)",
"type": "/automotive/model",
"query": $("#myinput").val(),
'output': '(description)'
'limit': 150,
"id": null,
"key": "***",
"name": null,
};
$.getJSON(search_service+'?callback=?',params, function(response) {
$("#related ul").empty();
for (var i=0; i<response['result'].length; i++) {
var related_entity = response['result'][i];
var list_item = $('<li></li>');
var container = $('<div class="related_entity"></div>');
list_item.append(container);
container.append($('<img src="https://usercontent.googleapis.com/freebase/v1/image' + related_entity['mid'] + '">'));
container.append($('<br/><a href="http://freebase.com"' + related_entity['mid'] + ' target="_blank">' + related_entity['name'] + '</a>'));
container.append($('<br/><p>' + related_entity['wikipedia'] + '</p>'));
$("#related ul").append(list_item);
}
$("#related").show();
});
});
$("#myinput").val("ford").change();
});
以下是完成错误的片段:
/*related search function*/
$(function() {
$("#myinput").change(function() {
var search_service = 'https://www.googleapis.com/freebase/v1/search';
var params = {
"filter": "(all type:/automotive/model)",
"type": "/automotive/model",
"query": $("#myinput").val(),
'output': '(description)',
'limit': 150,
"id": null,
"key": "***",
"name": null,
};
$.getJSON(search_service+'?callback=?',params, function(response) {
$("#related ul").empty();
for (var i=0; i<response['result'].length; i++) {
var related_entity = response['result'][i];
var list_item = $('<li></li>');
var container = $('<div class="related_entity"></div>');
list_item.append(container);
container.append($('<img src="https://usercontent.googleapis.com/freebase/v1/image' + related_entity['mid'] + '">'));
container.append($('<br/><a href="http://freebase.com"' + related_entity['mid'] + ' target="_blank">' + related_entity['name'] + '</a>'));
container.append($('<br/><p>' + related_entity['wikipedia'] + '</p>'));
403错误仅出现在图像上,而且我现在没有接近每天100,000个请求,我整个月都是150。 任何帮助都非常有用 亲切的问候 克里斯
答案 0 :(得分:1)
我不再在文档中看到图片API,因此Google可能正在弃用它(或者他们可能忘记记录它)。
首先,我尝试将?key=YOUR_API_KEY
添加到图片服务网址,看看是否有帮助。