|
| 1 | +--- |
| 2 | +title: CLI command examples |
| 3 | +description: 'Practical examples for every just-scrape command' |
| 4 | +--- |
| 5 | + |
| 6 | +## Smart Scraper |
| 7 | + |
| 8 | +Extract structured data from any URL using AI. |
| 9 | + |
| 10 | +```bash |
| 11 | +# Basic extraction |
| 12 | +just-scrape smart-scraper https://news.ycombinator.com \ |
| 13 | + -p "Extract the top 10 story titles and their URLs" |
| 14 | + |
| 15 | +# Enforce a strict output schema |
| 16 | +just-scrape smart-scraper https://news.example.com \ |
| 17 | + -p "Get all article headlines and dates" \ |
| 18 | + --schema '{"type":"object","properties":{"articles":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"date":{"type":"string"}}}}}}' |
| 19 | + |
| 20 | +# Scroll to load more content, then extract |
| 21 | +just-scrape smart-scraper https://store.example.com/shoes \ |
| 22 | + -p "Extract all product names, prices, and ratings" \ |
| 23 | + --scrolls 5 |
| 24 | + |
| 25 | +# Bypass anti-bot protection (costs +4 credits) |
| 26 | +just-scrape smart-scraper https://app.example.com/dashboard \ |
| 27 | + -p "Extract user stats" \ |
| 28 | + --stealth |
| 29 | + |
| 30 | +# Pass cookies and custom headers |
| 31 | +just-scrape smart-scraper https://example.com/protected \ |
| 32 | + -p "Extract the protected content" \ |
| 33 | + --cookies '{"session": "abc123"}' \ |
| 34 | + --headers '{"X-Custom-Header": "value"}' |
| 35 | +``` |
| 36 | + |
| 37 | +## Search Scraper |
| 38 | + |
| 39 | +Search the web and extract structured data from results. |
| 40 | + |
| 41 | +```bash |
| 42 | +# Research across multiple sources |
| 43 | +just-scrape search-scraper "What are the best Python web frameworks in 2025?" \ |
| 44 | + --num-results 10 |
| 45 | + |
| 46 | +# Get raw markdown only (2 credits instead of 10) |
| 47 | +just-scrape search-scraper "React vs Vue comparison" \ |
| 48 | + --no-extraction --num-results 5 |
| 49 | + |
| 50 | +# Structured output with schema |
| 51 | +just-scrape search-scraper "Top 5 cloud providers pricing" \ |
| 52 | + --schema '{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"free_tier":{"type":"string"}}}}}}' |
| 53 | +``` |
| 54 | + |
| 55 | +## Markdownify |
| 56 | + |
| 57 | +Convert any webpage to clean markdown. |
| 58 | + |
| 59 | +```bash |
| 60 | +# Convert a blog post |
| 61 | +just-scrape markdownify https://blog.example.com/my-article |
| 62 | + |
| 63 | +# Save to file |
| 64 | +just-scrape markdownify https://docs.example.com/api \ |
| 65 | + --json | jq -r '.result' > api-docs.md |
| 66 | + |
| 67 | +# Bypass Cloudflare or anti-bot protections |
| 68 | +just-scrape markdownify https://protected.example.com --stealth |
| 69 | +``` |
| 70 | + |
| 71 | +## Crawl |
| 72 | + |
| 73 | +Crawl multiple pages and extract data from each. |
| 74 | + |
| 75 | +```bash |
| 76 | +# Crawl a docs site and collect code examples |
| 77 | +just-scrape crawl https://docs.example.com \ |
| 78 | + -p "Extract all code snippets with their language" \ |
| 79 | + --max-pages 20 --depth 3 |
| 80 | + |
| 81 | +# Crawl only blog pages |
| 82 | +just-scrape crawl https://example.com \ |
| 83 | + -p "Extract article titles and summaries" \ |
| 84 | + --rules '{"include_paths":["/blog/*"],"same_domain":true}' \ |
| 85 | + --max-pages 50 |
| 86 | + |
| 87 | +# Get raw markdown from all pages (no AI extraction, cheaper) |
| 88 | +just-scrape crawl https://example.com \ |
| 89 | + --no-extraction --max-pages 10 |
| 90 | +``` |
| 91 | + |
| 92 | +## Scrape |
| 93 | + |
| 94 | +Get raw HTML from a URL. |
| 95 | + |
| 96 | +```bash |
| 97 | +# Basic HTML fetch |
| 98 | +just-scrape scrape https://example.com |
| 99 | + |
| 100 | +# Geo-targeted request with anti-bot bypass |
| 101 | +just-scrape scrape https://store.example.com \ |
| 102 | + --stealth --country-code DE |
| 103 | + |
| 104 | +# Extract branding info (logos, colors, fonts) |
| 105 | +just-scrape scrape https://example.com --branding |
| 106 | +``` |
| 107 | + |
| 108 | +## Sitemap |
| 109 | + |
| 110 | +Get all URLs from a website's sitemap. |
| 111 | + |
| 112 | +```bash |
| 113 | +# List all pages |
| 114 | +just-scrape sitemap https://example.com |
| 115 | + |
| 116 | +# Pipe URLs to another command |
| 117 | +just-scrape sitemap https://example.com --json | jq -r '.urls[]' |
| 118 | +``` |
| 119 | + |
| 120 | +## Agentic Scraper |
| 121 | + |
| 122 | +Browser automation with AI — login, click, navigate, fill forms. |
| 123 | + |
| 124 | +```bash |
| 125 | +# Log in and extract dashboard data |
| 126 | +just-scrape agentic-scraper https://app.example.com/login \ |
| 127 | + -s "Fill email with user@test.com,Fill password with secret,Click Sign In" \ |
| 128 | + --ai-extraction -p "Extract all dashboard metrics" |
| 129 | + |
| 130 | +# Navigate a multi-step form |
| 131 | +just-scrape agentic-scraper https://example.com/wizard \ |
| 132 | + -s "Click Next,Select Premium plan,Fill name with John,Click Submit" |
| 133 | + |
| 134 | +# Persist browser session across runs |
| 135 | +just-scrape agentic-scraper https://app.example.com \ |
| 136 | + -s "Click Settings" --use-session |
| 137 | +``` |
| 138 | + |
| 139 | +## Generate Schema |
| 140 | + |
| 141 | +Generate a JSON schema from a natural language description. |
| 142 | + |
| 143 | +```bash |
| 144 | +# Generate a schema |
| 145 | +just-scrape generate-schema "E-commerce product with name, price, ratings, and reviews array" |
| 146 | + |
| 147 | +# Refine an existing schema |
| 148 | +just-scrape generate-schema "Add an availability field" \ |
| 149 | + --existing-schema '{"type":"object","properties":{"name":{"type":"string"},"price":{"type":"number"}}}' |
| 150 | +``` |
| 151 | + |
| 152 | +## History |
| 153 | + |
| 154 | +Browse request history interactively or export it. |
| 155 | + |
| 156 | +```bash |
| 157 | +# Interactive history browser (arrow keys to navigate) |
| 158 | +just-scrape history smartscraper |
| 159 | + |
| 160 | +# Fetch a specific request by ID |
| 161 | +just-scrape history smartscraper abc123-def456-7890 |
| 162 | + |
| 163 | +# Export last 100 crawl jobs as JSON |
| 164 | +just-scrape history crawl --json --page-size 100 \ |
| 165 | + | jq '.requests[] | {id: .request_id, status}' |
| 166 | +``` |
| 167 | + |
| 168 | +Services: `markdownify`, `smartscraper`, `searchscraper`, `scrape`, `crawl`, `agentic-scraper`, `sitemap` |
0 commit comments