Skip to content

Instantly share code, notes, and snippets.

@blubbll
Created February 4, 2019 09:30
Show Gist options
  • Select an option

  • Save blubbll/72d325690025b17125221ff931e52ead to your computer and use it in GitHub Desktop.

Select an option

Save blubbll/72d325690025b17125221ff931e52ead to your computer and use it in GitHub Desktop.
getBingData
/*const getBingData = async() => new Promise((resolve, reject) => {
fetch('https://bing.com'
)
.then(function(response) {
if (response.ok)
return response.text();
else
throw new Error('Bild konnte nicht geladen werden');
})
.then(function(html) {
const $ = cheerio.load(html)
const img = `https://bing.com/${$('link#bgLink')[0].attribs['href']}`;
//const txt = $('h1.hpcInfoText')[0].children[0].data;
//resolve({img, txt});
resolve({img});
})
});*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment