No description
- Python 98.6%
- Dockerfile 1.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| __pycache__ | ||
| helpers | ||
| .gitignore | ||
| api.py | ||
| Dockerfile | ||
| README.md | ||
| requirements.txt | ||
Playwright Scrape API (Python/FastAPI port)
Browser rendering service built with FastAPI, Playwright, and CloakBrowser's stealth Chromium. Byte-compatible port of the TypeScript Express service.
Features
- Scrapes HTML content from specified URLs.
- Blocks requests to known ad-serving domains.
- Blocks media files to reduce bandwidth usage (BLOCK_MEDIA=true).
- SSRF protection at two layers (route interception + local egress proxy).
- Optional upstream proxy chaining (PROXY_SERVER/PROXY_USERNAME/PROXY_PASSWORD).
- No User-Agent randomization — CloakBrowser presents a coherent fingerprint.
- Structured cookies can be supplied as Playwright cookie dictionaries using the
cookiesfield. Each entry must includename,value, and eitherurlordomain; domain cookies default topath: "/". Positiveexpiresvalues and validsameSitevalues (Strict,Lax, orNone) are preserved, while non-positive expiry and invalidsameSiteare omitted. Ifcookiesis non-empty, it takes precedence over aheaders.Cookievalue for cookie-jar seeding; the legacy Cookie-header behavior remains unchanged when structured cookies are absent or empty. - Invalid structured cookie entries reject the request with HTTP 400, including the entry index and validation reason. This is intentionally stricter than the service's otherwise validate-nothing behavior.
Install
pip install -r requirements.txt
playwright install-deps chromium
python -m cloakbrowser install