Skip to content

Instantly share code, notes, and snippets.

@rominirani
Created October 21, 2018 14:50
Show Gist options
  • Save rominirani/43e8a2863fe8ba3de4e9a75318e99da0 to your computer and use it in GitHub Desktop.
Save rominirani/43e8a2863fe8ba3de4e9a75318e99da0 to your computer and use it in GitHub Desktop.
Puppeteer code snippet to fetch comic strip
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