botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Bing web search API to search only specific sites

Open msBot1111 opened this issue 9 years ago • 7 comments

I'm using Bing web search API for getting articles about health in my Bot. How can I specify in the API which sites(urls) to search? Because sometimes it searches irrelevant sites, like wiki or wikipedia which I don't want to use. I've tried with site: parameter in API but it only gets the first site and ignores the rest urls. Here is the API which I use now: https://api.cognitive.microsoft.com/bing/v5.0/search?q=site:cdc.gov/ NOT site:wikipedia.org/" +url+ "&count=10&offset=0&mkt=en-us&safesearch=Moderate"

msBot1111 avatar Mar 02 '17 14:03 msBot1111

https://social.msdn.microsoft.com/Forums/azure/en-US/6aa2fa51-144e-4111-9e41-27142484e7ab/can-urls-be-whitelisted-when-using-bing-search-api?forum=DataMarket looks like it uses extra parentheses around the argument of the NOT operator - you might consider posting to that forum with further questions.

willportnoy avatar Mar 02 '17 19:03 willportnoy

@msBot1111 Did the answer from @willportnoy work for you?

carlosscastro avatar Mar 09 '17 17:03 carlosscastro

no :/, maybe that worked before, but now it doesn't work anymore

msBot1111 avatar Mar 10 '17 08:03 msBot1111

@msBot1111 Did you modify your code based on the answer from @willportnoy above?

carlosscastro avatar Mar 10 '17 19:03 carlosscastro

@carlosscastro yes I've tried with that but it's not working for me

msBot1111 avatar Mar 13 '17 08:03 msBot1111

@msBot1111 As this is a problem on talking to Bing web search api, you'd get the best help from them. I can pass your issue to them, or you can do that yourself directly by posting your question here: https://cognitive.uservoice.com/

carlosscastro avatar Mar 13 '17 21:03 carlosscastro

I know I am late to the party but this is what worked for me. From the docs I got the template and my final url string was this "https://api.cognitive.microsoft.com/bing/v7.0/news/search?q=heart+disease+%28site%3Abbc.co.uk+OR+site%3Acnn.com%29&mkt=en-US"

varun-jois avatar Nov 28 '17 09:11 varun-jois