Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Obscura

Obscura

The open-source headless browser for AI agents and web scraping.
Lightweight, stealthy, and built in Rust.


Obscura is a headless browser engine written in Rust, built for web scraping and AI agent automation. It runs real JavaScript via V8, supports the Chrome DevTools Protocol, and acts as a drop-in replacement for headless Chrome with Puppeteer and Playwright.

Why Obscura over headless Chrome?

Designed for automation at scale, not desktop browsing.

MetricObscuraHeadless Chrome
Memory30 MB200+ MB
Binary size70 MB300+ MB
Anti-detectBuilt-inNone
Page load85 ms~500 ms
StartupInstant~2s
PuppeteerYesYes
PlaywrightYesYes

Install

Download

Grab the latest binary from Releases:

# Linux x86_64 curl -LO https://github.com/h4ckf0r0day/obscura/releases/latest/download/obscura-x86_64-linux.tar.gz tar xzf obscura-x86_64-linux.tar.gz ./obscura fetch https://example.com --eval "document.title" # macOS Apple Silicon curl -LO https://github.com/h4ckf0r0day/obscura/releases/latest/download/obscura-aarch64-macos.tar.gz tar xzf obscura-aarch64-macos.tar.gz # macOS Intel curl -LO https://github.com/h4ckf0r0day/obscura/releases/latest/download/obscura-x86_64-macos.tar.gz tar xzf obscura-x86_64-macos.tar.gz # Windows Download the `.zip` from the releases page and extract it manually.

Single binary. No Chrome, no Node.js, no dependencies.

Build from source

git clone https://github.com/h4ckf0r0day/obscura.git cd obscura cargo build --release # With stealth mode (anti-detection + tracker blocking) cargo build --release --features stealth

Requires Rust 1.75+ (rustup.rs). First build takes ~5 min (V8 compiles from source, cached after).

Quick Start

Fetch a page

# Get the page title obscura fetch https://example.com --eval "document.title" # Extract all links obscura fetch https://example.com --dump links # Render JavaScript and dump HTML obscura fetch https://news.ycombinator.com --dump html # Wait for dynamic content obscura fetch https://example.com --wait-until networkidle0

Start the CDP server

obscura serve --port 9222 # With stealth mode (anti-detection + tracker blocking) obscura serve --port 9222 --stealth

Scrape in parallel

obscura scrape url1 url2 url3 ... \ --concurrency 25 \ --eval "document.querySelector('h1').textContent" \ --format json

Puppeteer / Playwright

Puppeteer

npm install puppeteer-core
import puppeteer from 'puppeteer-core'; const browser = await puppeteer.connect({ browserWSEndpoint: 'ws://127.0.0.1:9222/devtools/browser', }); const page = await browser.newPage(); await page.goto('https://news.ycombinator.com'); const stories = await page.evaluate(() => Array.from(document.querySelectorAll('.titleline > a')) .map(a => ({ title: a.textContent, url: a.href })) ); console.log(stories); await browser.disconnect();

Playwright

npm install playwright-core
import { chromium } from 'playwright-core'; const browser = await chromium.connectOverCDP({ endpointURL: 'ws://127.0.0.1:9222', }); const page = await browser.newContext().then(ctx => ctx.newPage()); await page.goto('https://en.wikipedia.org/wiki/Web_scraping'); console.log(await page.title()); await browser.close();

Form submission & login

await page.goto('https://quotes.toscrape.com/login'); await page.evaluate(() => { document.querySelector('#username').value = 'admin'; document.querySelector('#password').value = 'admin'; document.querySelector('form').submit(); }); // Obscura handles the POST, follows the 302 redirect, maintains cookies

Benchmarks

Page load:

PageObscuraChrome
Static HTML51 ms~500 ms
JS + XHR + fetch84 ms~800 ms
Dynamic scripts78 ms~700 ms

Stealth Mode

Enable with --features stealth.

Anti-fingerprinting

  • Per-session fingerprint randomization (GPU, screen, canvas, audio, battery)
  • Realistic navigator.userAgentData (Chrome 145, high-entropy values)
  • event.isTrusted = true for dispatched events
  • Hidden internal properties (Object.keys(window) safe)
  • Native function masking (Function.prototype.toString()[native code])
  • navigator.webdriver = undefined (matches real Chrome)

Tracker Blocking

  • 3,520 domains blocked
  • Blocks analytics, ads, telemetry, and fingerprinting scripts
  • Prevents trackers from loading entirely
  • Enabled automatically with --stealth

CDP API

Obscura implements the Chrome DevTools Protocol for Puppeteer/Playwright compatibility.

DomainMethods
TargetcreateTarget, closeTarget, attachToTarget, createBrowserContext, disposeBrowserContext
Pagenavigate, getFrameTree, addScriptToEvaluateOnNewDocument, lifecycleEvents
Runtimeevaluate, callFunctionOn, getProperties, addBinding
DOMgetDocument, querySelector, querySelectorAll, getOuterHTML, resolveNode
Networkenable, setCookies, getCookies, setExtraHTTPHeaders, setUserAgentOverride
Fetchenable, continueRequest, fulfillRequest, failRequest (live interception)
StoragegetCookies, setCookies, deleteCookies
InputdispatchMouseEvent, dispatchKeyEvent
LPgetMarkdown (DOM-to-Markdown conversion)

CLI Reference

obscura serve

Start a CDP WebSocket server.

FlagDefaultDescription
--port9222WebSocket port
--proxyHTTP/SOCKS5 proxy URL
--stealthoffEnable anti-detection + tracker blocking
--workers1Number of parallel worker processes
--obey-robotsoffRespect robots.txt

obscura fetch <URL>

Fetch and render a single page.

FlagDefaultDescription
--dumphtmlOutput: html, text, or links
--evalJavaScript expression to evaluate
--wait-untilloadWait: load, domcontentloaded, networkidle0
--selectorWait for CSS selector
--stealthoffAnti-detection mode
--quietoffSuppress banner

obscura scrape <URL...>

Scrape multiple URLs in parallel with worker processes.

FlagDefaultDescription
--concurrency10Parallel workers
--evalJS expression per page
--formatjsonOutput: json or text

License

Apache 2.0


关于 About

The headless browser for AI agents and web scraping

语言 Languages

Rust100.0%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
17
Total Commits
峰值: 12次/周
Less
More

核心贡献者 Contributors