Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
let grabPosts = await page.evaluate(() => {
let allPosts = document.body.querySelectorAll('.Post');
// storing the post items in an array then selecting for retrieving content
scrapeItems = [];
allPosts.forEach(item => {
let postTitle = item.querySelector('h3');
let postDescription = item.querySelector('p');
postTitle: postTitle ? postTitle.innerText : null,
postDescription: postDescription ? postDescription.innerText : null,
let items = {
"redditPosts": scrapeItems,
return items;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.