通过Python只返回Google搜索结果的数量
我希望以尽可能快的方式返回特定关键字的google搜索结果的数量,避免(保持最小)使用第三方库。我已经考虑过xgoogle了 您可以使用下载站点并解析出通过Python只返回Google搜索结果的数量,python,Python,我希望以尽可能快的方式返回特定关键字的google搜索结果的数量,避免(保持最小)使用第三方库。我已经考虑过xgoogle了 您可以使用下载站点并解析出 …值。以下是一个例子: 看一看 如果您搜索一些模糊的东西,如“cars”,那么数据将如下所示。注意它不是很长;你只会得到最热门的几个点击,还有一个链接到“moreResultsUrl”。因此,进行此查询并查看 数据['cursor']['estimatedResultCount']用于估计点击数 {'cursor': {'currentPage
…
值。以下是一个例子:
看一看
如果您搜索一些模糊的东西,如“cars”,那么数据
将如下所示。注意它不是很长;你只会得到最热门的几个点击,还有一个链接到“moreResultsUrl”。因此,进行此查询并查看
数据['cursor']['estimatedResultCount']
用于估计点击数
{'cursor': {'currentPageIndex': 0,
'estimatedResultCount': '168000000',
'moreResultsUrl': 'http://www.google.com/search?oe=utf8&ie=utf8&source=uds&start=0&hl=en&q=cars',
'pages': [{'label': 1, 'start': '0'},
{'label': 2, 'start': '4'},
{'label': 3, 'start': '8'},
{'label': 4, 'start': '12'},
{'label': 5, 'start': '16'},
{'label': 6, 'start': '20'},
{'label': 7, 'start': '24'},
{'label': 8, 'start': '28'}]},
'results': [ <<list of 4 dicts>> ]}
{'cursor':{'currentPageIndex':0,
“estimatedResultCount”:“168000000”,
“moreResultsUrl”:”http://www.google.com/search?oe=utf8&ie=utf8&source=uds&start=0&hl=en&q=cars',
“pages':[{'label':1,“start':'0'},
{'label':2,'start':'4'},
{'label':3,'start':'8'},
{'label':4,'start':'12'},
{'label':5,'start':'16'},
{'label':6'start':'20'},
{'label':7,'start':'24'},
{'label':8'start':'28'}]},
“结果”:[]
您的问题是什么?你的代码在哪里?值得一提的是,在使用urllib时,你必须伪造浏览器代理id——谷歌不赞成自动查询……谢谢,这个答案还帮助我解决了一些我一直坚持的问题。