I am trying to get the Bing wallpaper data using the following request url: http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1 I have the following code:
private string getJsonData()
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "application/json");
client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Dragon/43.3.3.185 Chrome/43.0.2357.81 Safari/537.36");
using (var response = client.GetAsync("http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1").Result)
{
response.EnsureSuccessStatusCode();
return response.Content.ReadAsStringAsync().Result;
}
}
}
The problem is that I receive the copyrightlink equal to javascript:void(0), and as you can see, if I make the same request with the browser, I get a valid URL: http://www.bing.com/search?q=Brooklyn+Heights,+New+York&form=hpcapt&filters=HpDate:%2220150906_0700%22
I have tried quite a lot of things regarding the headers sent with the request, with no success, so I suppose the problem is coming from somewhere else. Any suggestions?
Note: the same issue is present when using xml as the requested format
Thanks!