mdfetch
A Python library that extracts article content from web platforms and returns it as clean Markdown.
Install
pip
pip install mdfetch
Homebrew (macOS / Linux)
brew install stn1slv/tap/md-fetch
No Python environment setup required.
CLI Usage
You can use the built-in md-fetch command directly from your terminal:
# Fetch and print Markdown to standard output
md-fetch https://medium.com/example/article
# Fetch and save Markdown to a file
md-fetch https://dev.to/example/article --output article.md
# Fallback to Tavily API if the primary extractor fails (requires TAVILY_API_KEY)
export TAVILY_API_KEY="tvly-..."
md-fetch https://example.com/unsupported-blog --tavily-fallback
# List all supported platforms (no URL or network needed)
md-fetch --list-platforms
Python Usage
from mdfetch import extract
# Works with any supported platform — just pass the URL
markdown = extract("https://medium.com/some-publication/article-slug-abc123")
markdown = extract("https://dev.to/username/article-slug")
markdown = extract("https://example.substack.com/p/article-slug")
markdown = extract("https://thenewstack.io/article-slug")
markdown = extract("https://dzone.com/articles/article-slug")
markdown = extract("https://boomi.com/blog/article-slug")
markdown = extract("https://konghq.com/blog/category/article-slug")
# Fallback to Tavily API if the primary extractor fails (requires TAVILY_API_KEY env var)
markdown = extract("https://example.com/unsupported-blog", tavily_fallback=True)
print(markdown)
Error handling
from mdfetch import (
extract,
InvalidURLError,
UnsupportedPlatformError,
UnsupportedContentTypeError,
FetchError,
HTTPStatusError,
EmptyContentError,
MissingAPIKeyError,
)
url = "https://medium.com/some-publication/article-slug-abc123"
try:
markdown = extract(url)
except InvalidURLError as e:
print(f"Bad URL: {e.message}")
except UnsupportedPlatformError as e:
print(f"Platform not supported: {e.message}")
except UnsupportedContentTypeError as e:
print(f"Not an article page: {e.message}")
except HTTPStatusError as e:
print(f"HTTP {e.status_code}: {e.message}")
except FetchError as e:
print(f"Network error: {e.message}")
except EmptyContentError as e:
print(f"No content: {e.message}")
except MissingAPIKeyError as e:
print(f"Missing API Key: {e.message}")
Supported platforms
| Platform | Domains |
|---|---|
| Medium | medium.com, *.medium.com |
| dev.to | dev.to |
| Substack | substack.com, *.substack.com |
| The New Stack | thenewstack.io |
| DZone | dzone.com |
| Boomi | boomi.com |
| Kong | konghq.com |
Development
Requires uv.
make setup # install dependencies
make test # run unit tests
make integration # run integration tests (requires network access)
make lint # ruff check
make format # ruff format
make build # build wheel + sdist
make upgrade-deps # upgrade all dependencies
make clean # remove build artifacts
Requirements
- Python 3.12+
Release files for mdfetch 0.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mdfetch-0.9.3.tar.gz | 496.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mdfetch-0.9.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 517.7 kB
Release files / mdfetch-0.9.3.tar.gz
| Download URL | mdfetch-0.9.3.tar.gz |
|---|---|
| Size | 496.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7ae13c52d8404cbefeb830de5554cd5690a08e8d8c9b5d3b96f30dd343c1c06
|
|
BLAKE2b-256 checksum How to use checksums |
b1e672d2a22177cc3d946dd1ecd47a6b3af44a335a12124605672b218b85dd2f
|
| 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 26, 2026.
Transparency logRelease files / mdfetch-0.9.3-py3-none-any.whl
| Download URL | mdfetch-0.9.3-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
647752ccb4f9849d8b075026be962dfed503ee6d3d37156e495059ad57ab839e
|
|
BLAKE2b-256 checksum How to use checksums |
9b174ca044d1f3c23bbc0f07cbca8f4ac88bfa7c89b599d14ab80c2aba6a1502
|
| 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 26, 2026.
Transparency log