Python library and CLI to fetch any web page as Markdown
Project description
FetchMD
Fetch any web page as clean Markdown.
Features
- 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.
Install
Requires Python >= 3.10.
uv tool install fetchmd
CLI
# 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.com
Python API
from fetchmd import fetchmd
md = fetchmd("https://example.com")
Behavior
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.
Testing
Run tests on a single Python version:
uv run --python 3.12 --with pytest -- pytest
Run the supported-version matrix:
./scripts/test-matrix.sh
Override versions (space-separated):
PY_VERSIONS="3.10 3.11 3.12 3.13 3.14" ./scripts/test-matrix.sh
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
fetchmd-0.1.0.tar.gz
(30.9 kB
view details)
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 fetchmd-0.1.0.tar.gz.
File metadata
- Download URL: fetchmd-0.1.0.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5ea587457e711f0cc377b43af4ca6c768be6a98cc7fe33b04794caf951dc74c
|
|
| MD5 |
73eabdbc7a212437395758c54cd6d0d1
|
|
| BLAKE2b-256 |
8b64cc797b6361bda5d41b802f1ae5d22827d7c71bbc082fa4825ecd2c19b573
|
File details
Details for the file fetchmd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fetchmd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4413b847941afcb9f0d143757ab34321f61c6049abff87f528179b3a46dfc5d6
|
|
| MD5 |
da952ef74d61a3753e30e4edaec395b3
|
|
| BLAKE2b-256 |
941e2934d2f99832e797ed1fa45d69369bebde4c36b7e595d1e052a9f7164e10
|