Turn Your Chrome into an API: How bb-browser Enables Claude Code to Pull Live Data
The article explains how the open‑source bb-browser turns a logged‑in Chrome instance into an API, letting AI agents like Claude Code bypass API limits and scrape data directly, while comparing it to traditional headless browsers, detailing setup, supported sites, integration methods, and known pitfalls.
Problem
When trying to let AI agents such as Claude Code gather data, three roadblocks were encountered: GitHub’s REST API rate limits, the need for API keys on Stack Overflow, and the lack of public APIs for many Chinese platforms. Manual copy‑paste or custom HTML scraping proved slow and fragile.
Core Idea – Your Browser Is the API
bb-browser (BadBoy Browser) adopts the philosophy “Your browser is the API.” It runs a local daemon (default 127.0.0.1:19824) that connects to the user’s Chrome via the Chrome DevTools Protocol (CDP) WebSocket. The daemon then executes fetch() calls or injects the site’s own webpack modules using the logged‑in cookies, making the browser appear as a regular user to the target site.
Why It Differs from Traditional Approaches
Playwright/Selenium launch headless browsers that lack the user’s login state and are easily detected as bots.
Python requests lacks a browser environment and must steal cookies, leading to high maintenance.
bb-browser does the opposite: it lets the machine use the human‑visible interface, preserving the login session without extra keys or headless detection.
Implementation Details
The daemon starts on 127.0.0.1:19824 and talks to Chrome via CDP. It can evaluate JavaScript in a chosen tab to call fetch() directly, or inject a site’s webpack module to invoke internal APIs. From the site’s perspective, the request comes from a normal logged‑in user.
Supported Platforms
bb-browser already covers 36 platforms with 103 commands, each backed by a separate JavaScript adapter stored in the bb-sites repository. Examples include:
Search: Google, Baidu, Bing, DuckDuckGo, Sogou, WeChat
Social: Twitter/X, Reddit, Weibo, Xiaohongshu, Jike, LinkedIn, Hupu
News: BBC, Reuters, 36Kr, Toutiao, Eastmoney
Tech: GitHub, StackOverflow, HackerNews, CSDN, V2EX, arXiv, npm, PyPI
Video: YouTube, Bilibili
Encyclopedia: Wikipedia, Zhihu, Open Library
Shopping: What’s Worth Buying
Tools: Youdao Translate, GSMArena, Product Hunt, Ctrip
Adding a new site only requires a single JS file in the bb-sites repo.
Three Integration Methods
Method 1 – CLI (fastest start)
npm install -g bb-browser
bb-browser site update # pull community adapters
bb-browser site zhihu/hot
bb-browser site github/repo epiral/bb-browser
bb-browser site boss/search "AI engineer"
bb-browser site youtube/transcript VIDEO_IDMethod 2 – MCP (Claude Code / Cursor)
{
"mcpServers": {
"bb-browser": {
"command": "npx",
"args": ["-y", "bb-browser", "--mcp"]
}
}
}Method 3 – OpenClaw Built‑in Support
bb-browser site reddit/hot --openclaw
bb-browser site xueqiu/hot-stock 5 --openclaw --jq '.items[] | {name, changePercent}'Structured JSON Output
All commands can emit clean JSON; the --json and --jq flags enable inline filtering, e.g.:
bb-browser site xueqiu/hot-stock 5 --jq '.items[] | {name, changePercent}'
# {"name":"云天化","changePercent":"2.08%"}
# {"name":"东芯股份","changePercent":"-7.60%"}Adapter Creation Levels
Level 1 : Simple cookie‑based fetch() (e.g., Reddit, GitHub, V2EX) – ~1 minute.
Level 2 : Requires handling Bearer and CSRF tokens (e.g., Twitter, Zhihu) – ~3 minutes.
Level 3 : Needs Webpack injection or Pinia store manipulation (e.g., Twitter search, Xiaohongshu) – ~10 minutes.
A stress test with 20 concurrent AI agents each reverse‑engineered a different site and produced usable adapters, showing the low cost of onboarding new sites.
Three Pitfalls and Mitigations
Chrome must stay running : Keep Chrome open (e.g., set it to launch at startup and leave at least one tab open) during tasks.
Code runs inside your browser : Only grant bb-browser to trusted agents; use a separate Chrome profile for sensitive accounts.
Remote access risks : The daemon listens on 127.0.0.1 by default; if exposing it, use private networks like Tailscale or ZeroTier and never open it to the public internet.
Repository Links
Open‑source repository: https://github.com/epiral/bb-browser
Adapter repository: https://github.com/epiral/bb-sites
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Architect Essentials
Committed to sharing quality articles and tutorials to help Java programmers progress from junior to mid-level to senior architect. We curate high-quality learning resources, interview questions, videos, and projects from across the internet to help you systematically improve your Java architecture skills. Follow and reply '1024' to get Java programming resources. Learn together, grow together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
