仅使用Google-Search-API的第一个结果

时间:2019-02-26 08:29:01

标签: python-3.x iteration google-search-api

我正在使用abenassi / Google-Search-API https://github.com/abenassi/Google-Search-API在一个小型python脚本中进行多个Google查询。我通常只需要第一个结果(链接),但是该程序用于收集整个结果页面。到目前为止,我一直在这样限制结果:

   public override Task TokenEndpoint(OAuthTokenEndpointContext context)
    {
        foreach (KeyValuePair<string, string> property in context.Properties.Dictionary)
        {
            context.AdditionalResponseParameters.Add(property.Key, property.Value);
        }
        return Task.FromResult<object>(null);
    }

问题在于(由于我认为)脚本很慢,这是因为在我获得一个链接之前必须遍历整个页面。有没有人看到我显然缺少的东西,或者有没有一种简单的方法来修改standard_search模块https://github.com/abenassi/Google-Search-API/blob/master/google/modules/standard_search.py,以将结果限制为仅第一个链接?谢谢!

0 个答案:

没有答案
相关问题