【发布时间】:2015-05-15 18:51:33
【问题描述】:
有没有办法将 Google 自定义搜索 API 返回的结果限制为每个域 1 个?
【问题讨论】:
有没有办法将 Google 自定义搜索 API 返回的结果限制为每个域 1 个?
【问题讨论】:
是的。如果您正在寻找第一个结果。那么熟悉Python的可以试试下面的方法。
res = service.cse().list(query,cx='YOURSEARCHENGINEIDHERE,).execute()
name = res['items'][0]['title'] #title of the first search result
url = res['items'][0]['link'] #url of the first search result
【讨论】: