Skip to main content

Extract article content from web platforms and return it as clean Markdown.

Project description

mdfetch

A Python library that extracts article content from web platforms and returns it as clean Markdown.

Install

pip install mdfetch

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")
print(markdown)

Error handling

from mdfetch import (
    extract,
    InvalidURLError,
    UnsupportedPlatformError,
    UnsupportedContentTypeError,
    FetchError,
    HTTPStatusError,
    EmptyContentError,
)

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}")

Supported platforms

Platform Domains
Medium medium.com, *.medium.com
dev.to dev.to

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+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdfetch-0.2.0.tar.gz (250.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdfetch-0.2.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file mdfetch-0.2.0.tar.gz.

File metadata

  • Download URL: mdfetch-0.2.0.tar.gz
  • Upload date:
  • Size: 250.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mdfetch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f60655a60f2c28b2fee77f0fd29ccf91114d286df6578526af426249bcf2c07b
MD5 544b04980fa369f5fe87c2069c8537b7
BLAKE2b-256 f4d201cf92573b924891dee6e24b85d8c837c248a0e53002d9a034b25a5706cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdfetch-0.2.0.tar.gz:

Publisher: publish.yml on stn1slv/md-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mdfetch-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mdfetch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mdfetch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52e7432ddc63e66e720df8ff162274c1c6c656e265512c3dd4d2b645448fbdd0
MD5 4662493628e1ab0260836d286d0dfd1b
BLAKE2b-256 11a0996c30ec95b5ed1ab24f1de08e09a1f953a8a7a1fa1220d9662dfbbd823f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdfetch-0.2.0-py3-none-any.whl:

Publisher: publish.yml on stn1slv/md-fetch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page