如何去除Google搜索API中的重复项?
我在我的应用程序中通过谷歌搜索API进行谷歌搜索。结果中出现了重复的内容。我该如何避免这种情况呢?我参考了这个链接:http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje
1 个回答
0
你可以查看以下链接中的过滤选项:
它使用了两种类型的过滤器:
- 重复片段过滤器
- 重复目录过滤器
所以在调用的时候,要把 Filter 设置为 True
results = server.doGoogleSearch(key, 'mark', 0, 10, False, "", ...)
这个API提供了以下参数:
key - Your Google API key
q - The search word
start - The index of the result to start on
maxResults - The number of results to return.
filter - If True, Google will filter out duplicate pages
restrict - Set this to country plus a country code to get results only from a particular country
safeSearch - If True, Google will filter out porn sites
lr (“language restrict”) - Set this to a language code
ie and oe must be "utf-8"