Skip to main content

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+

Metadata

Release files for mdfetch 0.9.5

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

Source distribution (sdist)

Source distribution for mdfetch 0.9.5
File Size Uploaded
mdfetch-0.9.5.tar.gz 516.9 kB Details

Built distribution (wheel)

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

Total release size: 538.2 kB

Release files / mdfetch-0.9.5.tar.gz

Download URL mdfetch-0.9.5.tar.gz
Size 516.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ec1976c78b41fd5a9685801e296fc6c0fdf70f5404aa6c1a5db53675a4bbd137
BLAKE2b-256 checksum
How to use checksums
f730881f36a22d7dc1b886cd4eff2db427997732f6eabd1b37603f5b3b6f168a
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 Oct 12, 2026.

Transparency log

Release files / mdfetch-0.9.5-py3-none-any.whl

Download URL mdfetch-0.9.5-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e90b4e0e4256cf97942c37b88194e5ee78f46a02791cf90d23c147349c9da4cc
BLAKE2b-256 checksum
How to use checksums
d0506484214af7c9f9e7b1e13150f312efcf817cc17c6d4e6c5ee05a85061439
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 Oct 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.9.5 This release

2 release files

0.9.4

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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