Precise Extraction
Extract DOM elements using CSS selectors or custom functions with Playwright's powerful automation.
Extract DOM elements with precision and speed
import { harvest } from 'domharvest-playwright'
// Extract quotes from quotes.toscrape.com (a site designed for scraping practice)
const quotes = await harvest(
'https://quotes.toscrape.com/',
'.quote',
(el) => ({
text: el.querySelector('.text')?.textContent?.trim(),
author: el.querySelector('.author')?.textContent?.trim(),
tags: Array.from(el.querySelectorAll('.tag')).map(tag => tag.textContent?.trim())
})
)
console.log(quotes)
// Output: Array of 10 quotes with authors and tagsDOMHarvest makes web scraping simple and reliable by leveraging Playwright's battle-tested browser automation. Whether you're building a data pipeline, monitoring websites, or extracting content for analysis, DOMHarvest provides the tools you need with minimal setup.