相关疑难解决方法(0)

如何使用google customsearch API查询高级搜索?

如何使用Google Python客户端库以编程方式使用Google自定义搜索API搜索引擎进行高级搜索,以便n根据我查询的高级搜索的某些术语和参数返回第一个链接列表?

我试图检查文档(我没有找到任何例子),这个答案.但是,后者没有用,因为目前不支持AJAX API.到目前为止我试过这个:

from googleapiclient.discovery import build
import pprint

my_cse_id = "test"

def google_search(search_term, api_key, cse_id, **kwargs):
    service = build("customsearch", "v1",developerKey="<My developer key>")
    res = service.cse().list(q=search_term, cx=cse_id, **kwargs).execute()
    return res['items']

results = google_search('dogs', my_api_key, my_cse_id, num=10)

for result in results:
    pprint.pprint(result)
Run Code Online (Sandbox Code Playgroud)

还有这个:

import pprint

from googleapiclient.discovery import build


def main():
  service = build("customsearch", "v1",developerKey="<My developer key>")

  res = service.cse().list(q='dogs').execute()
  pprint.pprint(res)

if __name__ == '__main__':
  main()
Run Code Online (Sandbox Code Playgroud)

因此,任何关于如何使用谷歌的搜索引擎API进行高级搜索的想法?这就是我的凭据在Google控制台上的显示方式:

证书

python google-api google-search-api python-3.x google-api-python-client

13
推荐指数
1
解决办法
2615
查看次数

用Python搜索谷歌

如何使用Python在Google上执行搜索查询?如何将搜索结果存储在Microsoft Word文档中?

python ms-word google-api

7
推荐指数
2
解决办法
8447
查看次数