Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
JavaScript web scraping libraries fetch web pages and extract structured data from their HTML. Pages that build their content with JavaScript need a headless browser to render them before extraction. These libraries let AI agents and data pipelines collect prices, listings, and articles from sites without an API.
Popularity
Playwright has the most monthly downloads in this comparison, at 576.3M.
import puppeteer from 'puppeteer';
// Or import puppeteer from 'puppeteer-core';// Launch the browser and open a new blank page.const browser = await puppeteer.launch();
const page = await browser.newPage();
// Navigate the page to a URL.await page.goto('https://developer.chrome.com/');
await browser.close();
async loadAndWait(url, pageCompleteCheck, engine) {
const driver = this.driver;
// Browsers may normalize 'https://x.com' differently; in particular, Firefox normalizes to // 'https://x.com/'. This is a first normalization attempt; there are deeper options that order // query parameters, order fragments, etc. We don't want to change url itself 'cuz it can be // used for indexing collected data and it is possible that normalization could change a key. const normalizedURI = new URL(url).toString();
// See https://github.com/sitespeedio/browsertime/issues/1698 const retries = 5;
let documentURI;
for (var index = 0; index < retries; index++) {
documentURI = await driver.executeScript('return document.documentURI;');
if (documentURI != undefined) {
break;
}
await delay(1000);
}
let startURI;
try {
startURI = new URL(documentURI).toString();
} catch (error) {
log.error(`Failed to get documentURI ${documentURI}`, error);
}
if (this.options.webdriverPageload) {
const clearOrange = `(function() {
const orange = document.getElementById('browsertime-orange');
if (orange) {
orange.parentNode.removeChild(orange);
}
})();`;
await driver.executeScript(clearOrange);
log.debug('Using webdriver.get to navigate');
await driver.get(url);
} else {
// To learn more about the event loop and request animation frame // watch Jake Archibald on ‘The Event Loop’ https://vimeo.com/254947206 // TODO do we only want to do this when we record a video? const navigate = `(function() {
const orange = document.getElementById('browsertime-orange');
if (orange) {
orange.parentNode.removeChild(orange);
}
window.requestAnimationFrame(function(){
window.requestAnimationFrame(function(){
window.location=${JSON.stringify(url)};
});
});
})();`;
// Navigate to the page log.debug('Using window.location to navigate');
await driver.executeScript(navigate);
}
if (this.options.pageCompleteCheckNetworkIdle) {
return engine.waitForNetworkIdle(driver);
} else {
// If you run with default settings, the webdriver will give back // control ASAP. Therefore you want to wait some extra time // before you start to run your page complete check this.options.pageLoadStrategy === 'none'
? await delay(this.options.pageCompleteCheckStartWait || 5000)
: await delay(2000);
// We give it a couple of times to finish loading, this makes it // more stable in real case scenarios on slow servers. let totalWaitTime = 0;
const tries = getProperty(this.options, 'retries', 5) + 1;
for (let index = 0; index < tries; ++index) {
try {
await this._waitOnPageCompleteCheck(pageCompleteCheck, normalizedURI);
const newURI = new URL(
await driver.executeScript('return document.documentURI;')
).toString();
// If we use a SPA it could be that we don't test a new URL so just do one try // and make sure your page complete check take care of other things if (this.options.spa) {
break;
} else if (normalizedURI === startURI) {
// You are navigating to the current page break;
} else if (normalizedURI.startsWith('data:text')) {
// Navigations between data/text seems to don't change the URI break;
} else if (newURI === 'chrome-error://chromewebdata/') {
// This is the timeout URL for Chrome, just continue to try throw new UrlLoadError(
`Could not load ${url} is the web page down?`,
url
);
} else if (newURI === startURI) {
const waitTime =
(this.options.retryWaitTime || 10_000) * (index + 1);
totalWaitTime += waitTime;
log.debug(
`URL ${url} failed to load, the ${
this.options.browser
} are still on ${startURI} , trying ${
tries - index - 1
} more time(s) but first wait for ${waitTime} ms.`
);
if (index === tries - 1) {
// If the last tries through an error, rethrow as before const message = `Could not load ${url} - the navigation never happend after ${tries} tries and total wait time of ${totalWaitTime} ms`;
log.error(message);
throw new UrlLoadError(message, url);
} else {
// We add some wait time before we try again await delay(waitTime);
log.info(
'Will check again if the browser has navigated to the page'
);
}
} else {
// We navigated to a new page, we don't need to test anymore break;
}
} catch (error) {
log.info(
`URL failed to load, trying ${tries - index - 1} more time(s): ${
error.message
}`
);
// if (index === tries - 1) {
// If the last tries through an error, rethrow as before log.error('Could not load URL %s', url, error);
throw new UrlLoadError('Failed to load ' + url, url, {
cause: error
});
} else {
await delay(1000);
}
}
}
}
}
Firecrawl
Searches, scrapes, crawls, and maps the web through the Firecrawl API for AI agents.
import { Firecrawl } from 'firecrawl';
const app = new Firecrawl({ apiKey: 'fc-YOUR_API_KEY' });
// Scrape a websiteconst scrapeResponse = await app.scrape('https://firecrawl.dev', {
formats: ['markdown', 'html'],
});
console.log(scrapeResponse);
FAQ
Cheerio suits static pages whose data is already in the server's HTML. Playwright and puppeteer suit pages that render content with JavaScript. Firecrawl suits AI agents that want clean page content from a hosted API.
Firecrawl is a hosted API that searches, scrapes, crawls, and maps websites for AI agents. Its JavaScript SDK returns page content as Markdown or structured data.
puppeteer is a Node.js library that controls Chrome and Firefox through a high-level API. Scrapers use it to load pages, wait for content, and read the rendered DOM.
Cheerio parses HTML and XML and exposes a jQuery-like API for selecting elements. It does not run page scripts or render the page.
selenium-webdriver drives browsers through the WebDriver standard. Playwright controls Chromium, Firefox, and WebKit through its own protocol with automatic waiting.
puppeteer controls Chrome and Firefox from Node.js. Playwright adds WebKit and ships clients for Python, Java, and .NET as well.
For coding agents
Found your web scraping library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.