【问题标题】:Google Custom Search API returns different total number of resultsGoogle Custom Search API 返回不同的结果总数
【发布时间】: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


【解决方案1】:

万一它仍然有用,我遇到了这个问题,对我来说,我在 Python 调用中将“dateRestrict”变量设置为 14 天,这意味着结果当然不同。

【讨论】:

    猜你喜欢
    • 2011-05-29
    • 2016-07-26
    • 2014-08-27
    • 1970-01-01
    • 2015-03-25
    • 1970-01-01
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    相关资源
    最近更新 更多