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.

Download files

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

Source Distribution

medium_converter-0.1.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

medium_converter-0.1.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file medium_converter-0.1.0.tar.gz.

File metadata

  • Download URL: medium_converter-0.1.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for medium_converter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03cffdefc83f0c44cb26825f6e562a4b38adff89b0c796f12e07276d1ac6c1e5
MD5 2bb2a0263457d4ef83fb6045696b2d2f
BLAKE2b-256 ca1ee7c3d3d09e2c0f22b963d58fe067ea93f0c2f39098dd0f0a480106ed3ced

See more details on using hashes here.

File details

Details for the file medium_converter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for medium_converter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfc1dd1dc69860de35326b9f39c35e8116f95512203de33c83c86fe7b6bd5664
MD5 90a8189d871fa5e56400c3ed6b7b1fc2
BLAKE2b-256 813bf79a19dbb57c1451c604a03c5c618f7ad704ada99f15b0f8dfe082f76d7c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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