Reader
Open source web infrastructure for AI.
Access the web without the complexity.
Docs · Examples
The Problem
Building agents that need web access is frustrating. You piece together Puppeteer, add stealth plugins, fight Cloudflare, manage proxies and it still breaks in production.
Because production grade web scraping isn't about rendering a page and converting HTML to markdown. It's about everything underneath:
| Layer |
What it actually takes |
| Browser architecture |
Managing browser instances at scale, not one-off scripts |
| Anti-bot bypass |
Cloudflare, Turnstile, JS challenges, they all block naive scrapers |
| TLS fingerprinting |
Real browsers have fingerprints. Puppeteer doesn't. Sites know. |
| Proxy infrastructure |
Standard vs premium, rotation strategies, sticky sessions |
| Resource management |
Browser pooling, memory limits, graceful recycling |
| Reliability |
Rate limiting, retries, timeouts, caching, graceful degradation |
I built Reader, a production-grade web scraping engine on top of Playwright, with stealth and anti-detection built in from the ground up.
The Solution
Three primitives. That's it.
import { ReaderClient } from "@vakra-dev/reader";
import { chromium } from "playwright-core";
const reader = new ReaderClient();
// 1. Scrape URLs → clean markdown
const result = await reader.scrape({ urls: ["https://example.com"] });
console.log(result.data[0].markdown);
// 2. Crawl a site → discover + scrape pages
const pages = await reader.crawl({
url: "https://example.com",
depth: 2,
scrape: true,
});
console.log(`Found ${pages.urls.length} pages`);
// 3. Browser session → full Playwright/Puppeteer control with stealth
const session = await reader.browser();
const browser = await chromium.connectOverCDP(session.wsEndpoint);
const page = browser.contexts()[0].pages()[0];
await page.goto("https://example.com");
console.log(await page.title());
await session.close();
All the hard stuff (browser pooling, anti-bot bypass, proxy rotation, retries) happens under the hood. You get clean markdown. Your agents get the web. And when you need full browser control, browser() gives you a stealthed Chrome that Playwright or Puppeteer can drive.
[!TIP]
If Reader is useful to you, a star on GitHub helps others discover the project.
Features
- Browser Sessions - Launch stealthed Chrome, connect Playwright/Puppeteer via CDP
- Anti-Bot Bypass - TLS fingerprinting, navigator spoofing, WebRTC masking,
webdriver=false
- Clean Output - Markdown and HTML with automatic main content extraction
- Smart Content Cleaning - Removes nav, headers, footers, popups, cookie banners
- CLI & API - Use from command line or programmatically
- Browser Pool - Auto-recycling, health monitoring, tiered proxy pools
- Concurrent Scraping - Parallel URL processing with progress tracking
- Website Crawling - BFS link discovery with depth/page limits
- Tiered Proxies - Standard and premium proxy pools with health tracking
Installation
npm install @vakra-dev/reader
Requirements: Node.js >= 18
First run: Playwright bundles Chromium for all platforms. Install it with:
npx playwright install chromium
Quick Start
Basic Scrape
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient();
const result = await reader.scrape({
urls: ["https://example.com"],
formats: ["markdown", "html"],
});
console.log(result.data[0].markdown);
console.log(result.data[0].html);
await reader.close();
Batch Scraping with Concurrency
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient();
const result = await reader.scrape({
urls: ["https://example.com", "https://example.org", "https://example.net"],
formats: ["markdown"],
batchConcurrency: 3,
onProgress: (progress) => {
console.log(`${progress.completed}/${progress.total}: ${progress.currentUrl}`);
},
});
console.log(`Scraped ${result.batchMetadata.successfulUrls} URLs`);
await reader.close();
Crawling
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient();
const result = await reader.crawl({
url: "https://example.com",
depth: 2,
maxPages: 20,
scrape: true,
});
console.log(`Discovered ${result.urls.length} URLs`);
console.log(`Scraped ${result.scraped?.batchMetadata.successfulUrls} pages`);
await reader.close();
Browser Session
Launch a stealthed Chrome and control it with Playwright or Puppeteer. The browser has anti-bot stealth active (webdriver=false, navigator spoofing, WebRTC masking). Your existing scripts just work.
import { ReaderClient } from "@vakra-dev/reader";
import { chromium } from "playwright-core";
const reader = new ReaderClient();
// Create a browser session - returns a CDP WebSocket URL
const session = await reader.browser();
// Connect Playwright (one-line change from a local script)
const browser = await chromium.connectOverCDP(session.wsEndpoint);
const context = await browser.newContext();
const page = await context.newPage();
// Use Playwright normally - full stealth active
await page.goto("https://news.ycombinator.com/");
console.log(await page.title());
await browser.close();
await session.close();
await reader.close();
Also works with Puppeteer:
import { connect } from "puppeteer-core";
const browser = await connect({ browserWSEndpoint: session.wsEndpoint });
With Proxy
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient();
const result = await reader.scrape({
urls: ["https://example.com"],
formats: ["markdown"],
proxy: {
type: "premium",
host: "proxy.example.com",
port: 8080,
username: "username",
password: "password",
country: "us",
},
});
await reader.close();
With Tiered Proxy Pools
Configure standard (datacenter, fast) and premium (residential, anti-bot) proxy tiers:
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient({
proxyPools: {
standard: [
{ url: "http://user:pass@dc-proxy1:8080" },
{ url: "http://user:pass@dc-proxy2:8080" },
],
premium: [{ url: "http://user:pass@res-proxy1:8080" }],
},
});
const result = await reader.scrape({
urls: ["https://example.com"],
proxyMode: "standard", // or "premium" for anti-bot sites
});
await reader.close();
Or via environment variables:
PROXY_STANDARD=http://user:pass@dc1:8080,http://user:pass@dc2:8080
PROXY_PREMIUM=http://user:pass@res1:8080
With Browser Pool Configuration
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient({
browserPool: {
size: 5, // 5 browser instances
retireAfterPages: 50, // Recycle after 50 pages
retireAfterMinutes: 15, // Recycle after 15 minutes
},
verbose: true,
});
const result = await reader.scrape({
urls: manyUrls,
batchConcurrency: 5,
});
await reader.close();
CLI Reference
Daemon Mode
For multiple requests, start a daemon to keep browser pool warm:
# Start daemon with browser pool
npx reader start --direct-pool-size 5
# All subsequent commands auto-connect to daemon
npx reader scrape https://example.com
npx reader crawl https://example.com -d 2
# Check daemon status
npx reader status
# Stop daemon
npx reader stop
# Force standalone mode (bypass daemon)
npx reader scrape https://example.com --standalone
reader scrape <urls...>
Scrape one or more URLs.
# Scrape a single URL
npx reader scrape https://example.com
# Scrape with multiple formats
npx reader scrape https://example.com -f markdown,html
# Scrape multiple URLs concurrently
npx reader scrape https://example.com https://example.org -c 2
# Save to file
npx reader scrape https://example.com -o output.md
| Option |
Type |
Default |
Description |
-f, --format <formats> |
string |
"markdown" |
Output formats (comma-separated: markdown,html) |
-o, --output <file> |
string |
stdout |
Output file path |
-c, --concurrency <n> |
number |
1 |
Parallel requests |
-t, --timeout <ms> |
number |
30000 |
Request timeout in milliseconds |
--batch-timeout <ms> |
number |
300000 |
Total timeout for entire batch operation |
--proxy <url> |
string |
- |
Proxy URL (e.g., http://user:pass@host:port) |
--user-agent <string> |
string |
- |
Custom user agent string |
--show-chrome |
flag |
- |
Show browser window for debugging |
--no-main-content |
flag |
- |
Disable main content extraction (include full page) |
--include-tags <sel> |
string |
- |
CSS selectors for elements to include (comma-separated) |
--exclude-tags <sel> |
string |
- |
CSS selectors for elements to exclude (comma-separated) |
-v, --verbose |
flag |
- |
Enable verbose logging |
reader crawl <url>
Crawl a website to discover pages.
# Crawl with default settings
npx reader crawl https://example.com
# Crawl deeper with more pages
npx reader crawl https://example.com -d 3 -m 50
# Crawl and scrape content
npx reader crawl https://example.com -d 2 --scrape
# Filter URLs with patterns
npx reader crawl https://example.com --include "blog/*" --exclude "admin/*"
| Option |
Type |
Default |
Description |
-d, --depth <n> |
number |
1 |
Maximum crawl depth |
-m, --max-pages <n> |
number |
20 |
Maximum pages to discover |
-s, --scrape |
flag |
- |
Also scrape content of discovered pages |
-f, --format <formats> |
string |
"markdown" |
Output formats when scraping (comma-separated) |
-o, --output <file> |
string |
stdout |
Output file path |
--delay <ms> |
number |
1000 |
Delay between requests in milliseconds |
-t, --timeout <ms> |
number |
- |
Total timeout for crawl operation |
--include <patterns> |
string |
- |
URL patterns to include (comma-separated regex) |
--exclude <patterns> |
string |
- |
URL patterns to exclude (comma-separated regex) |
--proxy <url> |
string |
- |
Proxy URL (e.g., http://user:pass@host:port) |
--user-agent <string> |
string |
- |
Custom user agent string |
--show-chrome |
flag |
- |
Show browser window for debugging |
-v, --verbose |
flag |
- |
Enable verbose logging |
reader browser
Launch a browser session with a CDP WebSocket endpoint.
# Create a session (prints wsEndpoint, blocks until Ctrl+C)
npx reader browser create
# Create with options
npx reader browser create --timeout 60000 --show-chrome
# List active sessions (daemon mode)
npx reader browser list
# Stop a session
npx reader browser stop <sessionId>
| Option |
Type |
Default |
Description |
--proxy <url> |
string |
- |
Proxy URL |
-t, --timeout <ms> |
number |
300000 |
Session lifetime in milliseconds |
--show-chrome |
flag |
- |
Show browser window |
--standalone |
flag |
- |
Force standalone mode |
-v, --verbose |
flag |
- |
Enable verbose logging |
API Reference
ReaderClient
The recommended way to use Reader. Manages the Playwright browser pool lifecycle automatically.
import { ReaderClient } from "@vakra-dev/reader";
const reader = new ReaderClient({ verbose: true });
// Scrape
const result = await reader.scrape({ urls: ["https://example.com"] });
// Crawl
const crawlResult = await reader.crawl({ url: "https://example.com", depth: 2 });
// Browser session
const session = await reader.browser();
// → session.wsEndpoint for Playwright/Puppeteer
// Close when done (optional - auto-closes on exit)
await reader.close();
Constructor Options
| Option |
Type |
Default |
Description |
verbose |
boolean |
false |
Enable verbose logging |