我该如何使用Google Python客户端库编程地进行高级搜索,并使用Google自定义搜索API搜索引擎,以便根据某些高级搜索的术语和参数返回一个前
我尝试查看文档(但没有找到任何示例),以及这个答案。然而,后者没有起作用,因为目前不支持AJAX API。到目前为止,我尝试了以下方法:
因此,有没有关于如何使用谷歌搜索引擎API进行高级搜索的想法?这是我在谷歌控制台中的凭据:credentials。
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)
还有这个:
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()
因此,有没有关于如何使用谷歌搜索引擎API进行高级搜索的想法?这是我在谷歌控制台中的凭据:credentials。
urls
,并且这些URL的语言为英语。 - J.Do