我正在尝试通过直接查询 freebase 的数据库来检索 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 个。任何帮助都非常感谢克里斯