Google有100个搜索配额,这太少了,根本无法使用。每次运行搜索时,配额会增加1。以下是代码:
string apiKey = "(MY API KEY HERE)";
string cx = "(MY CUSTOM SEARCH ENGINE CODE HERE)";
var tempi = 0;
var svc = new Google.Apis.Customsearch.v1.CustomsearchService(new BaseClientService.Initializer { ApiKey = apiKey });
string query = "test"
potato = 0;
var listRequest = svc.Cse.List(query);
listRequest.Cx = cx;
var search = listRequest.Execute();
foreach (var result in search.Items.Take(3))
{
if (potato == 0)
{
console.WriteLine("**Title:** " + result.Title + "\n**Link:** " + result.Link);
potato += 1;
}
}
有没有办法在每次使用查询时不用耗费查询?如果没有,是否有其他API可以实现类似功能?