Created
October 3, 2022 06:15
-
-
Save moozzyk/c9132ff55e2371dbf7b31f8229d0f14a to your computer and use it in GitHub Desktop.
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
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