Daily Bing image via JS/JQuery using Yahoo Query API , bypass the access control origin policy
// BING BING BING
// GET DAILY BING IMAGE VIA JS/JQUERY USING YAHOO QUERY API
// TO BYPASS ACCESS CONTROL ORIGIN POLICY
//
// KNOWN BING URL PARAMETERS ARE:
// format: js | xml | rss
// idx: 0 - n ( offset | 0 = current image only | 1 previous image )
// n: 0 - n ( how many images )
// mkt: country code for description ( doesnt mean the image switch for the next day, this is indicated by the tld )
//
// EXAMPLE BELOW FETCH 2 IMAGES IN A JSON-OBJECT INCLUDING CURRENT AND PREVIOUS IMAGE
// http://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=2&mkt=de-DE
// SEE: https://jsfiddle.net/telekommander/fqsg8oa7/
//
// NOW GET THE IMAGE:
$.getJSON("https://query.yahooapis.com/v1/public/yql", {
q: "select * from json where url='https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=de-DE'",
format: "json"
},
function (data) {
if (data.query.results) {
console.log(data.query.results.json.images.url);
}
}
);