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.7.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.7.0
File Size Uploaded Provenance Actions
playtrafi-0.7.0.tar.gz 152.1 kB With provenance Details for playtrafi-0.7.0.tar.gz

Built distribution (wheel)

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

Total release size: 181.2 kB

Release files / playtrafi-0.7.0.tar.gz

Download URL playtrafi-0.7.0.tar.gz
Size 152.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e9c047ca8837ed2fe7b4258171dfc90d31149ae329d2e61b8dc20cd56b283c35
BLAKE2b-256 checksum
How to use checksums
37df2354cdbc16adba99629ede65468b4262b1f082321557a265f20116a879e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

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

Download URL playtrafi-0.7.0-py3-none-any.whl
Size 29.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a24d53e83d9e77b6eb4d0eab178c76811c10b1aaa647294ece9156cb84c16d2d
BLAKE2b-256 checksum
How to use checksums
d7b8ceb0b134fdc6a97f109ae18b357939c9d56a2c746b9b5bd695ea9659eb1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

Security for playtrafi 0.7.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for playtrafi-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.

Transparency log

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.7.0 This release

2 release files Full 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