Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var url = inputData.url
- fetch(url)
- .then(res => res.text())
- .then(body => {
- const description = body.match(/<\/center>[\s\S]+<p>([\s\S]+<b> Explanation:[\s\S]+)<p> <center>/i)[1]
- const copyright = body.match(/(<b> Image Credit[\s\S]+<\/b>[\s\S]+)<\/center> <p>/i)[1]
- var imagePath = body.match(/<img src="([^"]+)"/i)[1]
- const imageURL = 'https://apod.nasa.gov/apod/' + imagePath
- var output = { url, imageURL, description, copyright }
- callback(null, output)
- })
- .catch(callback)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement