Pop*_*Car 4 .net c# google-search-api
谷歌拥有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;
}
}
Run Code Online (Sandbox Code Playgroud)
有没有办法使用它而不必每次都用完查询?如果没有,是否有任何其他API可以做类似的事情?
| 归档时间: |
|
| 查看次数: |
174 次 |
| 最近记录: |