Metadata-Version: 2.4
Name: medium2x
Version: 0.1.0
Summary: Convert Medium articles into paste-ready X (Twitter) Articles
Author-email: Urvil Joshi <urvvil08@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/urviljoshi/medium2x
Project-URL: Repository, https://github.com/urviljoshi/medium2x
Project-URL: Issues, https://github.com/urviljoshi/medium2x/issues
Keywords: medium,twitter,x,article,blogging,cli,rss
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Markup :: HTML
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typer>=0.12
Requires-Dist: feedparser>=6.0
Requires-Dist: requests>=2.31
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: lxml>=5.0
Requires-Dist: trafilatura>=1.9
Requires-Dist: questionary>=2.0
Requires-Dist: rich>=13.0
Dynamic: license-file

# medium2x

Convert a Medium article into a **paste-ready X (Twitter) Article** — keeping your headings, bold, italics, lists, links, and images, with minimal manual effort.

## Why

X has no API for posting rich Articles, and pasting a Medium post into X's Article composer normally strips all formatting and drops every image. `medium2x` does the tedious part for you: it fetches your Medium article, cleans the HTML, downloads the images, and produces a folder you can paste straight into X's Article composer with formatting intact.

You stay in control of the final publish — the tool gets you to one paste and a few image drags, instead of reformatting an entire article by hand.

## Install

```bash
# with pip
pip install medium2x

# as an isolated CLI tool (recommended)
pipx install medium2x
# or, with uv:
uv tool install medium2x

# run once without installing
uvx medium2x
```

## Usage

```bash
# interactive: prompts for your Medium username, then shows a picker
medium2x

# non-interactive: pick the Nth article from the feed (1-based)
medium2x --user @yourname --index 1

# convert an older article not in the latest-10 feed
medium2x --url https://medium.com/@yourname/your-article-slug-abc123

# convert a locally-saved page (workaround for member-only / paywalled posts)
medium2x --html-file saved-article.html

# choose where output goes (default: ./out)
medium2x --user @yourname --index 1 --out ./export
```

Each run writes a self-contained folder:

```
out/<article-slug>/
├── article.html      # open in a browser, Ctrl+A, Ctrl+C, paste into X
├── images/           # 01.jpg, 02.png, ... in reading order
└── HOW-TO.txt        # the paste + drag steps
```

## Publishing on X

1. Open `article.html` in your browser.
2. `Ctrl+A`, then `Ctrl+C` (the browser copies it as rich text).
3. On x.com: **Profile → Articles → Write Article**, click the body, `Ctrl+V`.
   Headings, bold, italics, lists, blockquotes, and links carry over.
4. For each `⟦ IMAGE NN ⟧` marker, upload the matching file from `images/`, then delete the marker.
5. Review and **Publish**.

## How it works

```
Medium RSS / URL  ->  clean & normalize HTML  ->  download images + insert markers  ->  article.html
```

Formatting survives because **HTML is the carrier of rich text on the web clipboard**: when your browser copies a rendered page, it places an HTML representation on the clipboard, and X's Article composer rebuilds the formatting from it. Markdown and plain text do not survive this path — which is why `medium2x` produces an HTML file rather than text.

## Limitations

- **Medium RSS returns only your latest 10 posts.** Use `--url` for older articles.
- **Member-only (paywalled) posts** expose only a preview to logged-out fetchers. Save the page from your browser while logged in and use `--html-file`.
- **Images are dragged/uploaded manually** — X requires real uploads; images can't be pasted through the clipboard.

## License

MIT
