{"id":51463324,"url":"https://github.com/dungle-scrubs/scraper","last_synced_at":"2026-07-06T08:01:14.761Z","repository":{"id":342576343,"uuid":"1174334675","full_name":"dungle-scrubs/scraper","owner":"dungle-scrubs","description":"Standalone web scraping service with anti-bot detection, Jina fallback, and LLM cleanup","archived":false,"fork":false,"pushed_at":"2026-06-28T06:58:49.000Z","size":445,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-28T08:21:54.165Z","etag":null,"topics":["crawl4ai","fastapi","python","scraper","web-scraping"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dungle-scrubs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-06T10:21:31.000Z","updated_at":"2026-06-28T06:58:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dungle-scrubs/scraper","commit_stats":null,"previous_names":["dungle-scrubs/dendrite-scraper","dungle-scrubs/scraper"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dungle-scrubs/scraper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dungle-scrubs%2Fscraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dungle-scrubs%2Fscraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dungle-scrubs%2Fscraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dungle-scrubs%2Fscraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dungle-scrubs","download_url":"https://codeload.github.com/dungle-scrubs/scraper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dungle-scrubs%2Fscraper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35182322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crawl4ai","fastapi","python","scraper","web-scraping"],"created_at":"2026-07-06T08:01:13.545Z","updated_at":"2026-07-06T08:01:14.751Z","avatar_url":"https://github.com/dungle-scrubs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scraper\n\nWeb scraping service with anti-bot detection and Jina fallback. Runs as a\nstandalone service or installs as a Python package.\n\n## Install\n\n```bash\npip install dungle-scrubs-scraper\n```\n\n## API\n\n```\nPOST /scrape {\"url\": \"https://example.com\"}\nGET  /health\n```\n\n### Response\n\n```json\n{\n  \"markdown\": \"# Page Title\\n\\nClean content...\\n\",\n  \"source\": \"crawl4ai\",\n  \"url\": \"https://example.com\",\n  \"bot_detected\": false,\n  \"error\": null,\n  \"elapsed_ms\": 1234.5,\n  \"attempts\": [\"crawl4ai attempt 1\"]\n}\n```\n\n## Pipeline\n\n1. **Crawl4AI** — local Playwright headless Chromium, retries on transient\n   errors\n2. **Bot detection** — Cloudflare/CAPTCHA phrases + partial JS render\n   heuristic (empty table cells)\n3. **Jina Reader fallback** — free cloud re-fetch when bot-blocked or crawl\n   fails\n4. **Artifact stripping** — regex patterns for \"Skip to content\", GitHub\n   chrome, duplicate lines\n\n## CLI\n\nThe `scraper` command exposes two subcommands:\n\n```bash\nscraper scrape \u003curl\u003e       # scrape a URL, JSON on stdout\nscraper scrape --stdin     # read {\"url\": \"...\"} from stdin\nscraper serve              # start the HTTP server\n```\n\n### JSON output (stdout)\n\nEvery `scrape` invocation writes exactly one JSON object to stdout:\n\n```json\n{\n  \"ok\": true,\n  \"markdown\": \"# Page Title\\n\\nClean content...\\n\",\n  \"source\": \"crawl4ai\",\n  \"url\": \"https://example.com\",\n  \"bot_detected\": false,\n  \"error\": null,\n  \"elapsed_ms\": 1234.5,\n  \"attempts\": [\"crawl4ai attempt 1\"]\n}\n```\n\nOn failure, `ok` is `false` and `error` contains the reason. The structure\nis always the same — callers can unconditionally `json.loads(stdout)`.\n\n### Exit codes\n\n| Code | Meaning |\n|------|---------|\n| 0 | Success — content scraped |\n| 1 | Scrape failed — all backends exhausted |\n| 2 | Invalid input — bad URL or malformed stdin JSON |\n| 3 | Timeout — global deadline exceeded |\n| 4 | Internal error — unexpected crash |\n\n### Timeout\n\nThe `--timeout` flag (default: 120s) wraps the entire pipeline in a\nglobal deadline. When exceeded, the process exits with code 3 and the\nJSON `error` field explains what happened.\n\n```bash\nscraper scrape --timeout 30 https://slow-site.example.com\n```\n\n### stdin mode\n\nPipe a JSON object with a `url` field:\n\n```bash\necho '{\"url\": \"https://example.com\"}' | scraper scrape --stdin\n```\n\nAll logging goes to stderr. stdout is exclusively for the JSON result.\n\n## Run locally\n\n```bash\nuv sync\nuv run scraper serve\n```\n\n## Run with Docker\n\n```bash\ndocker compose up -d\n```\n\n## Environment\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `SCRAPER_PORT` | No | Server port (default: 8020) |\n| `SCRAPER_HOST` | No | Bind address (default: `127.0.0.1`, local only; set `0.0.0.0` to expose) |\n| `SCRAPER_API_KEY` | No | When set, `POST /scrape` requires a matching `Authorization: Bearer` or `X-API-Key` header |\n| `SCRAPER_JINA_ENABLED` | No | Enable the third-party Jina Reader fallback (default: `false`) |\n| `SCRAPER_SERVER_TIMEOUT_SECONDS` | No | Global per-request deadline for `/scrape` (default: 120) |\n| `SCRAPER_MAX_CONCURRENT_SCRAPES` | No | Max concurrent scrapes before `503` (default: 4) |\n| `SCRAPER_CRAWL_TIMEOUT_SECONDS` | No | Crawl4AI timeout (default: 25) |\n\n## Security\n\nThis service fetches **arbitrary, caller-supplied URLs** and treats every\ninbound URL and every fetched page as untrusted. Defaults are tuned for a\n**local, single-user** tool:\n\n- **SSRF guard.** Every URL — on the crawl4ai path, the Jina path, the CLI, and\n  every redirect hop — is validated by a single guard that allows only\n  `http(s)` and rejects hosts resolving to loopback, private, link-local,\n  reserved, multicast, CGNAT, or cloud-metadata addresses (e.g.\n  `127.0.0.1`, `169.254.169.254`, `10.0.0.0/8`). Credentials in\n  `user:pass@host` URLs are stripped before any request.\n- **Local by default.** The server binds `127.0.0.1`. Set `SCRAPER_HOST=0.0.0.0`\n  to expose it — and set `SCRAPER_API_KEY` when you do.\n- **Optional auth.** With `SCRAPER_API_KEY` set, `POST /scrape` requires a\n  matching `Authorization: Bearer \u003ckey\u003e` or `X-API-Key: \u003ckey\u003e` header.\n- **Resource bounds.** A global per-request deadline, a concurrency cap\n  (`503` when exceeded), and response/markdown size caps protect against\n  hangs and memory exhaustion.\n- **Third-party egress is opt-in.** The Jina Reader fallback is disabled by\n  default (`SCRAPER_JINA_ENABLED=false`) because it sends the target URL to a\n  third party (`r.jina.ai`).\n\nReport vulnerabilities privately — see [SECURITY.md](SECURITY.md).\n\n## Use as a library\n\n```python\nfrom scraper.scraper import scrape\n\nresult = await scrape(\"https://example.com\")\nprint(result.markdown)\n```\n\n## Use as a service\n\nAll consumers need one env var:\n\n```bash\nSCRAPER_URL=http://localhost:8020\n```\n\n```python\nimport httpx\n\nresp = httpx.post(f\"{SCRAPER_URL}/scrape\", json={\"url\": url})\ndata = resp.json()\nmarkdown = data[\"markdown\"]\n```\n\n## Tests\n\n```bash\nuv run pytest tests/ -v\n```\n\n177 tests, all mocked — no network required.\n\n## Port\n\n8020 (registered in the shared port table).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdungle-scrubs%2Fscraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdungle-scrubs%2Fscraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdungle-scrubs%2Fscraper/lists"}