Created
February 4, 2019 09:30
-
-
Save blubbll/72d325690025b17125221ff931e52ead to your computer and use it in GitHub Desktop.
getBingData
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*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