How can I capture the HTML from a link in JavaScript? Alternatively, for a more conversational tone: W

20 Replies, 1217 Views

For scraping, you might wanna check out Puppeteer! It’s a headless browser that lets you grab HTML easily, even with JS-rendered content.

```javascript
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('your-url');
const html = await page.content();
console.log(html);
await browser.close();
})();
```

Overkill for simple stuff, but super powerful.

Messages In This Thread



Users browsing this thread: 1 Guest(s)