0

在我的 Bing 自定义搜索引擎中,我有一个空的活动列表,并且我的阻止列表中有一些网站。我想看到所有网络结果减去我的阻止列表,但这样我得到的结果为零。有没有办法我可以做到这一点?

编辑:已解决。请参阅下面的代码 注意:我使用 Bing Web 搜索 API 支持自定义搜索来实现我想要的结果。

# code solution, I was able to get my desired results and
# exclude a large number of websites with this method
# I can confirm that at least 20 stacked exclusions are working with no issues.

def bing_search(key,url,term):
    headers = {"Ocp-Apim-Subscription-Key" : subscription_key}
    params  = {"q": bterm, "textDecorations":True, "textFormat":"HTML"}
    response = requests.get(search_url, headers=headers, params=params)
    response.raise_for_status()
    search_results = response.json()




results = bing_search(subscription_key, search_url, (str(each) +
                                                             "-site:facebook.com "
                                                             "-site:yellowpages.com "
                                                             "-site:yelp.com "
                                                             "-site:local.yahoo.com "
                                                             "-site:manta.com "
                                                             "-site:searchonamerica.com "
                                                             "-site:wellness.com "
                                                             "-site:countyoffice.org "
                                                             "-site:buzzfile.com "
                                                             "-site:superpages.com "
                                                             "-site:dandb.com "
                                                             "-site:finduslocal.com "
                                                             "-site:chamberofcommerce.com "
                                                             "-site:whitepages.com "
                                                             "-site:businessfinder.nola.com "
                                                             "-site:yellowbook.com "
                                                             "-site:bizapedia.com "
                                                             "-site:bbb.org "
                                                             "-site:mapquest.com "
                                                             "-site:infofree.com "))

我希望自定义搜索引擎将来会允许此功能。

4

1 回答 1

0

如果被阻止的站点列表很小,您可以使用 Bing 网络搜索 API。您可以使用-site:www.xyz.com作为查询参数。这是 API 的链接:https ://azure.microsoft.com/en-us/services/cognitive-services/bing-web-search-api/ 。

于 2018-08-08T00:32:15.090 回答