Pure-Python article extraction library and HTTP service - Drop-in replacement for readability-js-server
Project description
Article Extractor
Article Extractor turns arbitrary HTML into deterministic Markdown ready for ingestion pipelines.
Problem: brittle scrapers collapse when paywalls or inline scripts mutate markup.
Why now: one fetcher abstraction keeps Playwright and httpx output identical across the CLI, FastAPI server, and Python API.
Outcome: verified tutorials, a single operations runbook, and concise reference tables keep teams unblocked in production.
Value At a Glance
- Deterministic Readability-style scoring tuned for long-form docs, blogs, and knowledge bases.
- GFM-compatible Markdown and sanitized HTML identical across the CLI, FastAPI server, and Python API.
- Runtime knobs for Playwright storage, cache sizing, proxies, diagnostics, and StatsD metrics.
- Test suite coverage above 93% plus documentation that records the exact commands and outputs.
See the Docs Home for the consolidated Tutorials, Operations, Reference, and Style sections.
Choose Your Surface
| Goal | Start Here | Time | Verified Commands |
|---|---|---|---|
| Run the CLI once | CLI Fast Path | < 2 min | uv pip install article-extractor, uv run article-extractor …, head ./tmp/article-extractor-cli.md |
| Ship the FastAPI server in Docker | Docker Service | ~5 min | docker run ghcr.io/pankaj28843/article-extractor:latest, curl http://localhost:3000/health, `curl -XPOST … |
| Embed the library | Python Embedding | ~5 min | uv run python - <<'PY' …, asyncio.run(fetch_remote()) |
| Tune caches, networking, diagnostics, releases | Operations Runbook | task-specific | Env vars, Docker overrides, StatsD flags, gh CLI |
Install (Any Environment)
pip install article-extractor # CLI + library
pip install article-extractor[server] # FastAPI server extras
pip install article-extractor[all] # Playwright, httpx, FastAPI, fake-useragent
Prefer uv? Run uv pip install article-extractor or add it to pyproject.toml via uv add article-extractor[all].
Developer / Active Development Install
When contributing or debugging locally, install as an editable tool so changes to src/ take effect immediately:
# Clone and install editable
git clone https://github.com/pankaj28843/article-extractor.git
cd article-extractor
uv tool install --editable --force --refresh --reinstall ".[all]"
# Now `article-extractor` CLI reflects local changes instantly
article-extractor https://example.com
See CONTRIBUTING.md for the full development workflow.
Crawl an Entire Site
Extract every page under a domain in one command:
# CLI: crawl up to 50 pages, output to ./output/
uv run article-extractor crawl https://example.com --max-pages 50 --output ./output
# Server: start a background crawl job
curl -X POST http://localhost:3000/crawl \
-H "Content-Type: application/json" \
-d '{"start_url": "https://example.com", "max_pages": 50}'
# Returns {"job_id": "abc123", "status": "running", ...}
The crawler follows internal links via BFS, respects robots.txt and sitemaps, and writes one Markdown file per page. Use --workers 3 (default is 1) to dispatch three concurrent crawl workers while --concurrency continues to cap simultaneous fetch slots. See the Crawling Guide for rate limiting, headed mode, and output structure.
Observability & Operations
- All runtimes honor diagnostics toggles (
ARTICLE_EXTRACTOR_LOG_DIAGNOSTICS,ARTICLE_EXTRACTOR_METRICS_*). - Playwright storage is opt-in: CLI/server runs stay ephemeral unless you pass
--storage-state /path/to/storage_state.jsonor setARTICLE_EXTRACTOR_STORAGE_STATE_FILEplus a bind-mounted volume. The Operations Runbook walks through mounting, warming caches, and inspecting the queue. - The Docker debug harness still exercises persistent storage for regression coverage; add
--disable-storagewhen you want the smoke to mirror the default ephemeral behavior. - Networking, diagnostics, StatsD, validation loops, and release automation live in a single Operations Runbook.
Documentation
The MkDocs site (Overview, Tutorials, Operations, Reference, Explanations) lives at https://pankaj28843.github.io/article-extractor/. If the site is unavailable, read the Markdown sources in docs/ including style-guide.md, operations.md, and content-inventory.md.
Contributing
We welcome pull requests paired with docs. Follow the Operations Runbook for validation and include real command output in the PR description when you update documentation.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file article_extractor-0.5.0.tar.gz.
File metadata
- Download URL: article_extractor-0.5.0.tar.gz
- Upload date:
- Size: 215.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a44c0f86aea4f666cb755ace04a1434509fc21794646bd9ad8b328800f3bbbc
|
|
| MD5 |
cd063630445c1338ce2605c0560c173e
|
|
| BLAKE2b-256 |
ce7795bbcce6fd44fff5415a74b7519bf0a168e5e20e04b53a29a71d99f93a39
|
File details
Details for the file article_extractor-0.5.0-py3-none-any.whl.
File metadata
- Download URL: article_extractor-0.5.0-py3-none-any.whl
- Upload date:
- Size: 68.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","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":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3742f716db7da57374ad0bf641d0808c0bd6937b9428fa0e1109b2aade0f7053
|
|
| MD5 |
a737f82b4af77f88403a1f448f305b3c
|
|
| BLAKE2b-256 |
3e79204609f318d899fde2c4dc10a7a5845cb9938aa511cf05489e532d3cc2b9
|