No description
  • Python 98.6%
  • Dockerfile 1.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-21 19:00:45 -07:00
__pycache__ incremental 2026-08-21 19:00:09 -07:00
helpers incremental 2026-08-21 19:00:09 -07:00
.gitignore incremental 2026-08-21 19:00:45 -07:00
api.py incremental 2026-08-21 19:00:09 -07:00
Dockerfile first commit 2026-08-19 06:50:10 -07:00
README.md incremental 2026-08-21 19:00:09 -07:00
requirements.txt bug fixes 2026-08-19 13:15:19 -07:00

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 cookies field. Each entry must include name, value, and either url or domain; domain cookies default to path: "/". Positive expires values and valid sameSite values (Strict, Lax, or None) are preserved, while non-positive expiry and invalid sameSite are omitted. If cookies is non-empty, it takes precedence over a headers.Cookie value 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