【发布时间】:2018-07-18 01:55:25
【问题描述】:
与我通常使用网络浏览器搜索 google 时相比,Google Custom Search API 返回的结果总数不同。
在自定义搜索控制面板上,搜索整个网络已打开。我按照this 设置,上面写着“请注意,结果可能与您在 Google 网页搜索中搜索得到的结果不匹配”,
这是为什么呢?
这是我的代码:
def main():
service = build("customsearch", "v1",
developerKey="my-key")
res = service.cse().list(
q='allintitle: hotels tokyo',
cx='my-key',
num=10,
).execute()
pprint.pprint(res)
if __name__ == '__main__':
main()
结果:
searchInformation': {'formattedSearchTime': '0.41',
'formattedTotalResults': '5,260',
'searchTime': 0.408312,
'totalResults': '5260'}
正常浏览器结果:
知道为什么会这样吗?
【问题讨论】:
-
对我来说,相同的搜索返回第 1 页,大约有 87,900 个结果(0.67 秒) - 我认为它的因素也是图像和地图,请注意当我到达最后一页时,我点击了“我们”已经省略了一些结果,请单击此处查看它们”这意味着公共 UI 本质上具有与 CSE 不同的算法(尽管架构拉取是相同的,但实际上和地理区域不同)结果会有所不同。
-
API 不使用同义词,因此它的结果数量要少得多。
标签: python-3.x google-custom-search