Skip to main content

ScrapeBadger CLI

A command-line tool for accessing ScrapeBadger APIs directly from your terminal. Supports multiple output formats, pipe-friendly design, and field selection.

Install

pip install scrapebadger-cli

Quick Start

# Set up your API key
scrapebadger auth --api-key sb_live_...

# Get a Twitter user profile
scrapebadger twitter user elonmusk

# Search tweets as a table
scrapebadger twitter search "AI agents" --output table

# Search Vinted in Germany
scrapebadger vinted search "nike shoes" --market de

# Scrape a URL with JS rendering
scrapebadger web scrape https://example.com --js

# Check your credits
scrapebadger credits

Authentication

The CLI resolves your API key in this order:
  1. SCRAPEBADGER_API_KEY environment variable
  2. .env file in the current directory
  3. ~/.config/scrapebadger/config.json (saved via scrapebadger auth)

Output Formats

Every command supports --output (-o) to choose the format:
FormatFlagBest For
JSON-o json (default)Piping to jq, programmatic use
CSV-o csvSpreadsheets, data analysis
Table-o tableHuman-readable terminal output
Markdown-o markdownDocumentation, reports

Field Selection

Use --fields (-f) to include only specific columns:
scrapebadger twitter trends -o csv -f name,domain_context

Commands

GroupCommands
Accountauth, credits, logout
Twitteruser, tweets, tweet, search, followers, following, mentions, trends, replies, quotes, retweeters, community, list, space + more
Vintedsearch, item, user, user-items, brands, markets
Webscrape, detect, screenshot, extract, batch, batch-status

Pipeline Examples

# Export trending topics to CSV
scrapebadger twitter trends -o csv > trends.csv

# Get followers and pipe to jq
scrapebadger twitter followers elonmusk | jq '.[].username'

# Scrape a page and extract text
scrapebadger web scrape https://example.com --format markdown

Environment Variables

VariableDescription
SCRAPEBADGER_API_KEYYour API key
SCRAPEBADGER_API_URLOverride the API base URL (default: https://scrapebadger.com)