Skip to main content

Medium Converter

PyPI version Python versions License Documentation Status Tests Release Docs

Convert Medium articles to various formats with optional LLM enhancement.

Features

  • 📚 Multiple export formats: Markdown, PDF, HTML, LaTeX, EPUB, DOCX
  • 🤖 LLM enhancement: Improve clarity and fix grammar with AI
  • 🔓 Paywall access: Use your browser cookies to access articles behind the paywall
  • 🎨 Custom styling: Customize the output appearance
  • ⚡ Async processing: Efficient batch conversion

Installation

# Basic installation
pip install medium-converter

# With PDF support
pip install medium-converter[pdf]

# With LLM enhancement using OpenAI
pip install medium-converter[llm,openai]

# All features
pip install medium-converter[all]

Quick Start

Command Line

# Convert to Markdown (default)
medium convert https://medium.com/example-article

# Convert to PDF with enhancement
medium convert https://medium.com/example-article -f pdf --enhance

Python API

import asyncio
from medium_converter import convert_article

async def main():
    # Basic conversion
    await convert_article(
        url="https://medium.com/example-article",
        output_format="markdown",
        output_path="article.md"
    )
    
    # With enhancement
    await convert_article(
        url="https://medium.com/example-article",
        output_format="pdf",
        output_path="article.pdf",
        enhance=True
    )

if __name__ == "__main__":
    asyncio.run(main())

Development Guide

Prerequisites

  • Python 3.11+
  • Poetry for dependency management

Setting Up Development Environment

# Clone the repository
git clone https://github.com/MarcusElwin/medium-converter.git
cd medium-converter

# Install dependencies with Poetry
poetry install --all-extras

# Activate virtual environment
poetry shell

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=medium_converter

Code Quality

# Run type checking
mypy medium_converter

# Run linting
ruff medium_converter

# Format code
black medium_converter

Building Documentation

# Build documentation
mkdocs build

# Serve documentation locally
mkdocs serve

Project Structure

medium-converter/
├── medium_converter/       # Main package
│   ├── __init__.py         # Public API & version
│   ├── cli.py              # CLI interface
│   ├── core/               # Core functionality
│   ├── exporters/          # Export formats
│   ├── llm/                # LLM integration
│   └── utils/              # Utilities
├── tests/                  # Test suite
├── docs/                   # Documentation
├── examples/               # Example scripts
├── pyproject.toml          # Project configuration
└── README.md               # Project readme

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

See Contributing Guide for more details.

Documentation

For detailed documentation, visit medium-converter.readthedocs.io.

LLM Providers

Medium Converter supports multiple LLM providers for content enhancement:

  • OpenAI (GPT models)
  • Anthropic (Claude models)
  • Google (Gemini models)
  • Mistral AI
  • Local models (via llama-cpp-python)

License

MIT License - See LICENSE for details.

Metadata

Release files for medium-converter 0.1.0

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

Source distribution (sdist)

Source distribution for medium-converter 0.1.0
File Size Uploaded
medium_converter-0.1.0.tar.gz 16.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for medium-converter 0.1.0
File Interpreter ABI Platform
medium_converter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.6 kB

Release files / medium_converter-0.1.0.tar.gz

Download URL medium_converter-0.1.0.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
03cffdefc83f0c44cb26825f6e562a4b38adff89b0c796f12e07276d1ac6c1e5
BLAKE2b-256 checksum
How to use checksums
ca1ee7c3d3d09e2c0f22b963d58fe067ea93f0c2f39098dd0f0a480106ed3ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / medium_converter-0.1.0-py3-none-any.whl

Download URL medium_converter-0.1.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bfc1dd1dc69860de35326b9f39c35e8116f95512203de33c83c86fe7b6bd5664
BLAKE2b-256 checksum
How to use checksums
813bf79a19dbb57c1451c604a03c5c618f7ad704ada99f15b0f8dfe082f76d7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

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