Skip to content

5a9awneh/windows-medium-backup

Repository files navigation

Windows Medium Backup

License PowerShell Docker Windows Last Commit Output Runs Locally Human in the Loop

Automated Medium post backup to Markdown for Windows using Docker Desktop (Hyper-V), powered by ZMediumToMarkdown.

🗺️ How It Works

flowchart TD
    Cookies[Get Medium cookies\nuid + sid from browser] --> Build
    Build[Build-ZMediumDocker.ps1\n--Username --CookieUID --CookieSID] --> Image[Docker image built\nZMediumToMarkdown]
    Image --> Backup[Medium-Backup.ps1]
    Backup --> Docker{Docker Desktop\nrunning?}
    Docker -->|❌ Not running| Start[Auto-start Docker\nwait for engine]
    Start --> Run
    Docker -->|✅ Running| Run[Run container\nfetch all posts]
    Run --> MD[Markdown files\n+ images saved to Output/]
    MD --> Restructure[Restructure into\nper-article folders\nfix asset paths]
    Restructure --> OutDir[Output/ next to script]
    OutDir --> Toast[Windows toast\nnotification]
    Toast --> Log[Write to log file\n30-day rotation]
    Log --> Done([✅ Backup complete])

    Sched[Register-Task.ps1\noptional daily trigger] -.->|triggers| Backup

    style Docker fill:#7a5500,color:#fff
    style Done fill:#2d6a2d,color:#fff
    style Start fill:#7a5500,color:#fff
Loading

❓ Why?

  • ✅ No WSL2 required (pure Hyper-V)
  • ✅ Handles paywall posts (with cookies)
  • ✅ Modern Windows notifications
  • ✅ Task Scheduler automation ready

🚀 Quick Start

Prerequisites

  • Windows 10/11 Pro/Enterprise/Education
  • Docker Desktop installed
  • Hyper-V enabled
  • PowerShell 5.1+

Installation

1. Get Medium Cookies:

  • Open Medium.com in browser (logged in)
  • Press F12 → Application → Cookies → medium.com
  • Copy uid value
  • Copy sid value

2. Build Docker Image:

.\Build-ZMediumDocker.ps1 -Username "yourname" -CookieUID "abc123" -CookieSID "def456"

3. Run Backup:

.\Medium-Backup.ps1 -Verbose

Sample run:

VERBOSE: Checking Docker Desktop status...
VERBOSE: Docker Desktop is running.
VERBOSE: Output location: C:\Users\yourname\windows-medium-backup\Output
VERBOSE: Starting ZMediumToMarkdown container for user: yourname
VERBOSE: Downloading posts...

  [1/12] the-hidden-registry-key-that-blocks-windows-hello.md  ✓
  [2/12] automating-medium-backup-on-windows.md                ✓
  [3/12] why-your-printer-address-book-wont-import.md          ✓
  ...
  [12/12] getting-started-with-pester-5.md                     ✓

VERBOSE: Restructuring 12 articles into per-article folders...
VERBOSE: Writing log: Medium-Backup-20260506.log
VERBOSE: Sending toast notification...

✅ Backup completed successfully!
📁 Location: C:\Users\yourname\windows-medium-backup\Output
📊 Articles: 12 (each in its own folder)
📝 Log: Medium-Backup-20260506.log

Done! Posts saved to Output\ next to the script.

📚 Documentation

📁 Output Structure

Output\
├── 2024-07-10-remove-sensitive-data-1ad65c2593f7\
│   ├── 2024-07-10-remove-sensitive-data-1ad65c2593f7.md
│   └── assets\
│       └── image.png
└── 2025-12-20-google-ai-product-chaos-e35dc04a7a4d\
    ├── 2025-12-20-google-ai-product-chaos-e35dc04a7a4d.md
    └── assets\
        └── image.jpg

Each article gets its own folder. Assets are co-located and image paths in the Markdown are rewritten automatically.

✨ Features

  • Automatic Docker management - Starts Docker if not running
  • Portable output - Saves next to the script; works inside OneDrive-synced folders too
  • Toast notifications - Visual feedback when backup completes
  • Automatic logging - 30-day log rotation
  • Error recovery - Detailed error messages and troubleshooting

📋 Requirements

Windows Edition

  • Windows 10/11 Pro, Enterprise, or Education
  • Home editions: Hyper-V not available (WSL2 support planned)

Software

  • Docker Desktop 4.0+ with Hyper-V backend
  • PowerShell 5.1+ (included in Windows)

🍪 Cookie Expiration

Medium cookies expire after 30-90 days. When backup fails with authentication error:

  1. Get fresh cookies (see above)
  2. Rebuild Docker image with new cookies
  3. Run backup again

See TROUBLESHOOTING.md for details.

🙏 Credits

📄 License

MIT License - See LICENSE file for details

🤝 Contributing

This is a simple utility project. Issues and pull requests welcome, but keeping scope minimal.

About

Automated Medium post backup to Markdown for Windows using Docker Desktop (Hyper-V). No WSL2 required.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors