CLI Examples
Practical examples and recipes for the Anakin CLI
Real-world usage patterns for the Anakin CLI.
Scrape a page to markdown
The most common use case — get clean, readable content from any URL:
anakin scrape "https://docs.python.org/3/tutorial/index.html" -o tutorial.mdExtract structured data with AI
Use --format json to get AI-extracted structured data instead of raw text:
anakin scrape "https://amazon.com/dp/B0EXAMPLE" --format json -o product.jsonThe AI analyzes the page and returns structured fields like title, price, description, etc.
Scrape a JavaScript-heavy site
For SPAs, React/Next.js sites, or pages with dynamically loaded content:
anakin scrape "https://app.example.com/dashboard" --browserThe --browser flag launches a headless browser to render JavaScript before extracting content.
Batch scrape multiple pages
Scrape up to 10 URLs in a single command. All are processed in parallel:
anakin scrape-batch \
"https://example.com/page-1" \
"https://example.com/page-2" \
"https://example.com/page-3" \
"https://example.com/page-4" \
"https://example.com/page-5" \
-o pages.jsonScrape from a specific country
Route your request through a proxy in a specific country. Useful for geo-restricted content:
# Scrape from the UK
anakin scrape "https://example.co.uk/deals" --country gb
# Scrape from Japan
anakin scrape "https://example.jp/products" --country jpSee the full list of 207 supported countries.
Scrape authenticated pages
Use a saved browser session to scrape pages that require login:
# First, create a session from the dashboard at anakin.io/dashboard
# Then use the session ID:
anakin scrape "https://example.com/my-account" --session-id "session_abc123"Learn more about Browser Sessions.
Pipe output to other tools
Progress messages go to stderr, so piping works cleanly:
# Extract a specific field with jq
anakin scrape "https://example.com" --format json | jq '.title'
# Count words in scraped markdown
anakin scrape "https://example.com" | wc -w
# Feed into another script
anakin search "latest AI papers" | python process_results.pyResearch a topic
Run deep multi-stage research that scrapes and synthesizes multiple sources:
anakin research "best practices for web scraping in 2025" -o research.jsonThis takes 1–5 minutes and produces a comprehensive report with citations.
Use in shell scripts
#!/bin/bash
# scrape-urls.sh — Scrape a list of URLs from a file
while IFS= read -r url; do
filename=$(echo "$url" | sed 's|https\?://||;s|/|_|g').md
echo "Scraping: $url -> $filename" >&2
anakin scrape "$url" -o "$filename"
done < urls.txtDebug a failing scrape
Use --format raw to see the full API response including headers, status codes, and error details:
anakin scrape "https://example.com" --format raw -o debug.jsonIf the default HTTP handler fails, try with --browser to use the headless browser:
anakin scrape "https://example.com" --browser --format raw -o debug.json