Skip to content

Instantly share code, notes, and snippets.

@moozzyk
Created October 3, 2022 06:15
Show Gist options
  • Save moozzyk/c9132ff55e2371dbf7b31f8229d0f14a to your computer and use it in GitHub Desktop.
Save moozzyk/c9132ff55e2371dbf7b31f8229d0f14a to your computer and use it in GitHub Desktop.
import * as puppeteer from "puppeteer";
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(
"https://seattle.craigslist.org/search/cta?query=blazer%20k5",
{
waitUntil: "networkidle0",
}
);
let elements = await page.$$("a.post-title");
console.log(elements.length);
await Promise.all(
elements.map(async (e) => {
let href = await e.getProperty("href");
console.log(await href.jsonValue());
})
);
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment