Convert Medium articles to various formats with LLM enhancement
Project description
Medium Converter
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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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.
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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03cffdefc83f0c44cb26825f6e562a4b38adff89b0c796f12e07276d1ac6c1e5
|
|
| MD5 |
2bb2a0263457d4ef83fb6045696b2d2f
|
|
| BLAKE2b-256 |
ca1ee7c3d3d09e2c0f22b963d58fe067ea93f0c2f39098dd0f0a480106ed3ced
|
File details
Details for the file medium_converter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: medium_converter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfc1dd1dc69860de35326b9f39c35e8116f95512203de33c83c86fe7b6bd5664
|
|
| MD5 |
90a8189d871fa5e56400c3ed6b7b1fc2
|
|
| BLAKE2b-256 |
813bf79a19dbb57c1451c604a03c5c618f7ad704ada99f15b0f8dfe082f76d7c
|