Created
October 21, 2018 14:50
-
-
Save rominirani/43e8a2863fe8ba3de4e9a75318e99da0 to your computer and use it in GitHub Desktop.
Puppeteer code snippet to fetch comic strip
This file contains 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 browser = await puppeteer.launch({args: ['--no-sandbox']}); | |
const page = await browser.newPage(); | |
await page.goto("https://loveiscomix.com/random"); | |
let imageurl = await page.evaluate(() => { | |
let item = document.querySelector('#primary > main > article > div > div.cellcomic > a > img'); | |
return 'https://loveiscomix.com/' + item.getAttribute('src'); | |
}) | |
browser.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment