Bypassing official YouTube Data API quota restrictions. Extract real-time channel metadata and watch metrics with zero API keys or limits.
This repository packages a high-performance FastAPI Scraper Microservice and a compiled Go CLI / Model Context Protocol (MCP) Server. It allows developers, content creators, and AI Agents to scrape, store, search, and analyze real-time YouTube metrics in a local SQLite database completely quota-free.
graph TD
User[Developer / AI Agent] -->|CLI Commands / MCP| GoCLI[Go CLI / MCP Server]
GoCLI -->|SQLite Persistent Store| DB[(SQLite Database)]
GoCLI -->|REST Requests| FastAPI[FastAPI Scraper Service]
FastAPI -->|Dynamic HTML Scraping| YouTube[YouTube Public Pages]
- Scraping Layer (Python & FastAPI): Parses public YouTube HTML structure and dynamically extracts JSON payloads (
ytInitialData) using brace-matching boundaries and recursive string evaluation. Supports rotating proxies for high-volume analytics. - Storage Layer (SQLite): Saves scraped data in a structured, local SQLite database containing channels and videos, complete with indexes for high-speed offline query fallback.
- Client Layer (Go CLI & MCP): Unified client binary generated by the CLI Printing Press. Operates as a fast interactive CLI, a pipeable JSON command runner, or a standard Model Context Protocol (MCP) server for Claude, Cursor, and agentic workflows.
Navigate to the scraper folder, install requirements, and run the FastAPI server:
cd scraper
pip install -r requirements.txt
uvicorn youtube_scraper:app --host 127.0.0.1 --port 8080The API will be active at
http://127.0.0.1:8080with Swagger docs at/docs.
In the repository root, build the Go CLI binary:
go build -o bin/youtube-scraper-pp-cli cmd/youtube-scraper-pp-cli/main.go# Get basic channel analytics (subscriber count, video count, display details)
./bin/youtube-scraper-pp-cli channel Google
# Get recent long-form uploads and cache them locally
./bin/youtube-scraper-pp-cli channel videos get-channel Google# Get real-time views, likes, and full description for a specific video
./bin/youtube-scraper-pp-cli video tfx2CjqtCUICustomize response envelopes and automate scripting with native format flags:
- Save as CSV:
--csv - JSON Array Output:
--json - Filter to Specific Columns:
--select id,title,view_count - Bypass local request cache:
--no-cache - Offline-Only Mode:
--data-source local(Queries only local database)
# Example: Select only titles and view counts, and format as CSV
./bin/youtube-scraper-pp-cli channel videos get-channel Google --csv --select title,view_countThis tool is optimized for consumption by AI Agents (like Claude Code, Cursor, or Custom LLM agents):
Append --agent to any command. This automatically sets:
- Non-interactive mode (disables terminal prompt blocks).
- Pure JSON output piped cleanly to
stdout. - No ANSI color escapes or decorative text wrappers.
./bin/youtube-scraper-pp-cli channel Code-With-Robby --agentTo expose these tools directly to Claude Desktop, register the compiled MCP binary:
-
Build the MCP binary:
go build -o bin/youtube-scraper-pp-mcp cmd/youtube-scraper-pp-mcp/main.go
-
Add the server to your Claude Desktop config (e.g.,
~/Library/Application Support/Claude/claude_desktop_config.json):{ "mcpServers": { "youtube-scraper": { "command": "/absolute/path/to/bin/youtube-scraper-pp-mcp" } } }
This repository has been fully audited to ensure:
- Zero user-specific access credentials, API keys, or cookies are stored.
- Zero personal identification paths, names, or private links are present in codebase definitions.
- The local database is isolated under
~/.local/share/youtube-scraper-pp-cli/data.dbto prevent workspace database leaks.
Generated and structured using the CLI Printing Press.