An AI-powered, multi-source scraping tool that works as an MCP server for agents. Give it a topic and it will:
- Generate smart keywords using a local LLM (OpenAI-compatible endpoint at
localhost:8888/v1). - Scrape the Web (Google / Bing / DuckDuckGo search + headless browser content extraction).
- Scrape X / Twitter via rotating Nitter instances.
- Scrape Reddit via PRAW.
- Search YouTube and extract video transcripts.
- Synthesize everything into a deep-dive report using the local LLM.
Built with Python 3.12+, asyncio, Playwright (+ stealth), BeautifulSoup4, PRAW,
youtube-transcript-api, Typer, and the official mcp library.
- Features
- Architecture
- Installation
- Configuration
- CLI Usage
- MCP Integration
- Export Formats
- Development
- FAQ / Troubleshooting
- License
- Multi-source deep dives — Web, X/Twitter (Nitter), Reddit, and YouTube in one pass.
- Local-first LLM — keyword generation and report synthesis against
http://localhost:8888/v1(e.g. Qwen3.6). No cloud API keys needed. - Concurrent scraping — all sources run concurrently via
asyncio.gather()with configurable concurrency and rate limiting (jittered delays). - Graceful degradation — if one source fails, the others keep going and the report still gets produced.
- Anti-detect headless browsing — Playwright +
playwright-stealthwith realistic browser headers generated viafaker. - Robust exports — JSON, CSV, Parquet, SQLite, and Markdown.
- MCP server — expose the
deep_divetool to Claude/Codex and any MCP-compatible agent. - Nitter rotation — falls through a list of Nitter instances until one responds.
┌──────────────────────────────────────┐
│ Agent / CLI │
│ (MCP client or `deepdive` command) │
└───────────────────┬──────────────────┘
│ topic + options
▼
┌──────────────────────────────────────┐
│ deepdive.engine │
│ run_deep_dive(topic, sources, ...) │
└───┬──────────┬──────────┬─────────┬──┘
│ │ │ │
│ │ │ │
┌─────────────▼──┐ ┌────▼─────┐ ┌──▼──────┐ │
│ llm.client │ │ sources │ │ sources │ │
│ generate_key │ │ web.py │ │ reddit │ │
│ words(topic) │ └────┬─────┘ │ .py │ │
└───────┬────────┘ │ └──┬──────┘ │
│ │ │ │
│ ┌───────────▼─────┐ ┌─▼────────▼─┐
│ │ x_twitter.py │ │ youtube.py │
│ │ (Nitter rotation)│ │ +transcripts│
│ └──────────────────┘ └────────────┘
│
│ all scraped data (lists of dicts)
▼
┌───────────────────────┐
│ llm.synthesizer │ create_report(data, topic)
│ chunked LLM synthesis│
└───────────┬───────────┘
▼
┌───────────────────────┐
│ utils.helpers │ write_output(data, path, format)
│ JSON/CSV/Parquet/ │
│ SQLite/Markdown │
└───────────────────────┘
Flow:
engine.run_deep_dive(topic, sources, output_format)is the single entry point.llm.client.generate_keywords(topic)produces targeted search terms.- Every selected scraper runs concurrently inside
asyncio.gather(), each returning alist[dict]shaped as{title, url, content/snippet, author, score, source, ...}. llm.synthesizer.create_report(data, topic)merges everything (chunking large payloads) into a structured deep-dive report via the local LLM.utils.helpers.write_output(...)persists the result in the requested format.
# 1. Clone / enter the repo
cd Deepdive-goblin-scrape
# 2. Create a virtual environment (Python 3.12+)
python3.12 -m venv .venv
source .venv/bin/activate
# 3. Install the package (editable, with dev + parquet extras)
pip install -e ".[dev,parquet]"
# 4. Install Playwright browsers
playwright install chromium
playwright install-deps chromium # system dependencies (optional but recommended)If you only need the default formats you can skip
parquet:pip install -e .
Configuration is loaded by deepdive/config.py (Pydantic BaseSettings) from, in order of
precedence: CLI flags > environment variables > defaults.
Key settings (all overridable via env, prefixed DEEPDIVE_):
| Setting | Env var | Default |
|---|---|---|
local_llm_url |
DEEPDIVE_LOCAL_LLM_URL |
http://localhost:8888/v1 |
local_api_key |
DEEPDIVE_LOCAL_API_KEY |
from ~/.mrboom/.local_api_key (else "local") |
nitter_instances |
DEEPDIVE_NITTER_INSTANCES |
https://nitter.privacydev.net, https://nitter.poast.org |
reddit_user_agent |
DEEPDIVE_REDDIT_USER_AGENT |
DeepDive/1.0 |
reddit_client_id |
DEEPDIVE_REDDIT_CLIENT_ID |
"" |
reddit_client_secret |
DEEPDIVE_REDDIT_CLIENT_SECRET |
"" |
reddit_username |
DEEPDIVE_REDDIT_USERNAME |
"" |
reddit_password |
DEEPDIVE_REDDIT_PASSWORD |
"" |
youtube_default_language |
DEEPDIVE_YOUTUBE_DEFAULT_LANGUAGE |
en |
max_concurrency |
DEEPDIVE_MAX_CONCURRENCY |
5 |
request_delay |
DEEPDIVE_REQUEST_DELAY |
1.5 |
proxies |
DEEPDIVE_PROXIES |
{} |
headers |
DEEPDIVE_HEADERS |
realistic browser defaults |
Environment-only settings can also be placed in a .env file at the repo root
(pip install python-dotenv not required — pydantic-settings reads .env natively).
Reddit requires API credentials to do anything useful (guest mode falls back gracefully). Create an app at https://www.reddit.com/prefs/apps and export:
export DEEPDIVE_REDDIT_CLIENT_ID=...
export DEEPDIVE_REDDIT_CLIENT_SECRET=...
export DEEPDIVE_REDDIT_USERNAME=...
export DEEPDIVE_REDDIT_PASSWORD=...The CLI is installed as deepdive (Typer).
# Basic deep dive, print to stdout
deepdive "AI in healthcare"
# Write a Markdown report
deepdive "AI in healthcare" --format markdown --output report.md
# JSON export
deepdive "quantum computing breakthroughs" --format json --output report.json
# CSV export
deepdive "best robotics projects for beginners" --format csv --output report.csv
# Only scrape a subset of sources
deepdive "AI agents" --sources web,reddit,youtube
# Only generate keywords (no scraping, no synthesis)
deepdive "AI agents" --keywords-only
# Tune concurrency / delay
deepdive "AI agents" --concurrency 10 --delay 0.5
# Use a proxy for outbound requests
deepdive "AI agents" --proxy "http://user:pass@proxy:8080"
# Override Nitter instances
deepdive "AI agents" --nitter-instance "https://nitter.example.com"
# Verbose logging
deepdive "AI agents" --verbosedeepdive TOPIC [--output PATH] [--format json|csv|parquet|sqlite|markdown]
[--sources web,x-twitter,reddit,youtube] [--concurrency INT]
[--delay FLOAT] [--proxy URL] [--nitter-instance URL]
[--keywords-only] [--verbose]
The MCP server lives in deepdive/mcp_server.py. It exposes a single tool:
deep_dive(topic: str, sources: list[str] | None, output_format: Literal[
"json", "csv", "parquet", "sqlite", "markdown"
])
The tool returns a structured result:
{
"executive_summary": "...",
"web_insights": [...],
"x_twitter_sentiment": [...],
"reddit_highlights": [...],
"youtube_breakdown": [...],
"deep_analysis": "...",
"metadata": {"topic": "...", "sources": [...], "generated_at": "...", "latency_ms": ...}
}
Edit claude_desktop_config.json:
{
"mcpServers": {
"deepdive": {
"command": "deepdive-mcp",
"args": []
}
}
}deepdive-mcp is a console entry point that runs the server over stdio
(see deepdive/mcp_server.py). You can also run it manually:
deepdive-mcpAny MCP client that can run a stdio subprocess works. See examples/config.yaml for a
ready-made config, and examples/queries.md for sample deep-dive prompts and expected
outputs.
Once connected, just ask the agent:
"Deep dive into the latest breakthroughs in quantum computing."
The agent will call the deep_dive tool and receive a synthesized report.
utils/helpers.write_output supports five formats:
| Format | Notes |
|---|---|
json |
Pretty-printed JSON of the full report structure. |
csv |
Flat CSV — one row per source result (via json_normalize). |
parquet |
Pandas/pyarrow required (pip install -e ".[parquet]"). |
sqlite |
Creates a .db with a results table and optional report table. |
markdown |
Readable human report with sections per source. |
# Run the test suite
pytest
# Lint
ruff check .
ruff format --check .
# Format
ruff format .- Create
deepdive/sources/<name>.pywithasync def scrape_<name>(topic, keywords, config) -> list[dict]. - Each result dict must include at least
title,url, andsource; add extra keys as appropriate (content,author,score, ...). - Register the new source in
engine.py(SOURCE_HANDLERS/ALL_SOURCES) and add it to the--sourceschoices incli.py.
- The local LLM is not running. The engine logs a warning and proceeds with a heuristic
fallback (raw keyword splitting + template-based synthesis) so scraping still works. Start
your Qwen3.6/OpenAI-compatible server at
http://localhost:8888/v1for full quality. - Reddit returns nothing. Guest browsing to Reddit is heavily rate limited; provide
reddit_client_id/reddit_client_secret(script app) for reliable access. - Nitter instances are down. The scraper rotates through all configured instances and
degrades gracefully if none respond. Add more instances via
DEEPDIVE_NITTER_INSTANCES. - Playwright browser not installed. Run
playwright install chromium. - Parquet export fails. Install the
parquetextra:pip install -e ".[parquet]".
MIT