Fetch any web page as clean Markdown.
- Fetches a URL and returns Markdown (sync, minimal API).
- Prefers Markdown/plain responses via
Accept, falls back to HTML conversion. - Extracts main content with readability by default.
- Absolutizes links and images for fetched URLs.
- Supports piping raw HTML via stdin.
Requires Python >= 3.10.
uv tool install fetchmd# Run without installing
uv run fetchmd https://example.com
# Install once, then:
fetchmd https://example.com
# Read raw HTML from stdin
curl https://example.com | fetchmd -
# Skip readability, convert full HTML
fetchmd --raw https://example.comfrom fetchmd import fetchmd
md = fetchmd("https://example.com")text/markdownandtext/plainare returned as-is.- HTML is cleaned with readability unless
--rawis used. - Relative
hrefandsrcare converted to absolute URLs for fetched pages. - When reading from stdin (
-), there is no base URL, so links remain unchanged.
Run tests on a single Python version:
uv run --python 3.12 --with pytest -- pytestRun the supported-version matrix:
./scripts/test-matrix.shOverride versions (space-separated):
PY_VERSIONS="3.10 3.11 3.12 3.13 3.14" ./scripts/test-matrix.sh