Skip to main content

🛡️ Playtrafi

The undetected stealth web scraper & clean Markdown extractor for LLMs and AI pipelines.

Python 3.10+ License: Apache 2.0 Engine: Patchright Extractor: Trafilatura Documentation


⚡ What is Playtrafi?

Playtrafi (formerly Patchtroy) is a lightweight, high-performance web crawling and content extraction engine designed specifically for LLMs, RAG pipelines, and AI agents.

It bridges the gap between low-level drivers and high-level scrapers by pairing Patchright (the C++ patched Chromium engine that eliminates automated telemetry leakages) with Trafilatura (the gold standard for algorithmic boilerplate removal and pristine Markdown conversion).

🎯 Why Playtrafi vs Crawl4AI & Firecrawl?

Feature Crawl4AI Firecrawl (Self-hosted) Playtrafi
Stealth Engine ❌ Standard Playwright (telemetry leaked) ❌ Blocked unless using paid SaaS ✅ Native Patchright Stealth
Boilerplate Stripping ⚠️ Heuristic regex ✅ Full DOM clean ✅ Trafilatura Gold Standard
Framework Data ⚠️ Partial regex ✅ ✅ Native Next.js (__NEXT_DATA__) & Schema.org JSON-LD
Dependencies ❌ Heavy (PyTorch, Transformers, ML) ❌ Complex (Node, Redis, BullMQ) ✅ Ultra-lean (< 15MB pure Python)
Throughput ⚠️ Process-level restart ⚠️ Queue bottleneck ✅ Browser Context Pool (>5x throughput)
Failure Tolerance ❌ Crashes on timeout ❌ ✅ Automatic fast HTTP fallback

📦 Installation

pip install playtrafi

# Install stealth Chromium driver
patchright install chromium

Note on Backwards Compatibility: patchtroy remains available as an import and CLI alias during the migration deprecation window.


🚀 Quickstart

Python (Async API)

import asyncio
from playtrafi import AsyncPlaytrafi

async def main():
    async with AsyncPlaytrafi() as client:
        result = await client.scrape("https://news.ycombinator.com")
        print("Title:", result.title)
        print("Markdown:\n", result.markdown[:300])

async def_run():
    asyncio.run(main())

Python (Sync 1-Liner)

from playtrafi import Playtrafi

result = Playtrafi.crawl("https://en.wikipedia.org/wiki/Web_scraping")
print(result.markdown[:300])

CLI

# Scrape clean Markdown directly to stdout
playtrafi https://news.ycombinator.com

# Save to Markdown, CSV, or JSON (auto-detected from file extension)
playtrafi https://example.com -o output.md
playtrafi https://example.com -o output.csv
playtrafi https://example.com -f json -o output.json

🧩 Core Architecture Highlights

  • 🛡️ Native Stealth Engine: Runs on Patchright's patched C++ Chromium binary, eliminating internal debugging flags and CDP telemetry before page scripts execute.
  • 🧹 Algorithmic Content Cleaning: Trafilatura strips 96%+ of navigation menus, advertisements, and tracking noise while preserving tables, code snippets, and Markdown formatting.
  • ⚡ Browser Context Pool: Reuses a single background browser process across requests, leasing isolated browser contexts for >5x higher throughput and lower RAM usage.
  • 🧠 Structure-Aware LLM Chunking: Recursively splits Markdown documents along heading hierarchy (#, ##, ###) with token estimation and metadata tracking.
  • 🐳 Standalone REST Microservice: Single lightweight Docker container exposing /scrape, /scrape/batch, and /health on port 4013 for any programming language.

📖 Documentation

Full documentation, API references, architecture guides, and benchmarks are available at the Playtrafi Documentation Portal:


📄 License

Playtrafi is open-source software created by @marcuz-apl and maintained by Alfazen Inc., released under the Apache 2.0 License.

Metadata

Release files for playtrafi 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for playtrafi 0.6.0
File Size Uploaded Provenance Actions
playtrafi-0.6.0.tar.gz 149.8 kB Without provenance Details for playtrafi-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for playtrafi 0.6.0
File Interpreter ABI Platform Actions
playtrafi-0.6.0-py3-none-any.whl Python 3 none any Details for playtrafi-0.6.0-py3-none-any.whl

Total release size: 177.9 kB

Release files / playtrafi-0.6.0.tar.gz

Download URL playtrafi-0.6.0.tar.gz
Size 149.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a80090e81669389c0c2ca9a9abd5cfae45d3cd8601a2ac5b08793d54ccfea71b
BLAKE2b-256 checksum
How to use checksums
40b3bd9907929b07ad76e9a0c8a32b2f6f7ec17cb09c7209405905771a126ccc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / playtrafi-0.6.0-py3-none-any.whl

Download URL playtrafi-0.6.0-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c0ba0b5ea112597e27d437b0c539417a1bdba7fec97a51506da091d27233035
BLAKE2b-256 checksum
How to use checksums
5b6e9077942c5ef697eba356da9bb4f19a87ef34bc298fbb7a6e63bc29415e2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for playtrafi 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page