I am trying to migrate from Bing search API v2 to the new Cognitive Search API v5. I am able to connect and execute a news search. But in the results I cant seem to get any of the search result URLs (target sites) like "url" = "http://somewebsite/newsarticle" instead I get results like: "url": "http://www.bing.com/cr?IG=A5F6CFB521CE442EB8ADC2B9DAD61C9F&CID=0EC3F0C" ....
Microsoft documentation states I should be getting the real target url: See the line "url": "http://tech.firstpost.com/news-analy..." in the api documentation : https://dev.cognitive.microsoft.com/docs/services/56b43f72cf5ff8098cef380a/operations/56b449fbcf5ff81038d15cdf
But when I open the test console on the same page it gives me the "http://www.bing.com/cr?IG=A5F6..." results.
What am I missing? Thanks for your help.
I figured out a workaround. Does not seem ideal, but forks for now. Wrote a method that parses the target URL from the Bing URL:
url = TryGetUrlFromBingUrl(BingResultUrl);
private string TryGetUrlFromBingUrl(string BingURL)
{
var queryString = HttpUtility.ParseQueryString(BingURL);
if (!string.IsNullOrEmpty(queryString["r"]))
{
return queryString["r"];
} else
{
return BingURL;
}
}