Stop Rewriting Transcripts! This Script Auto-Publishes YouTube to Medium
What if every YouTube video you created automatically became a polished, SEO-optimized Medium article—without you writing a single word?
Here's the brutal truth most content creators won't admit: they're leaving thousands of dollars on the table. You spend 8 hours scripting, recording, and editing a killer YouTube video. Then what? It disappears into the algorithm abyss after 48 hours. Meanwhile, your competitors who repurpose content are building evergreen traffic machines on Medium, capturing search traffic for years.
But here's the painful part—manually converting videos to articles is soul-crushing work. Raw transcripts read like robots having seizures. "Um, so, like, today we're gonna, uh, talk about..." Nobody reads that garbage. Hiring writers? $200-500 per article. Doing it yourself? Kiss your weekend goodbye.
What if I told you a single Python script eliminates this entire nightmare?
Enter pH-7/youtube-to-medium-blog-posts-automation—the open-source automation that transforms your YouTube channel into a self-publishing Medium empire. Not clunky transcript dumps. Real, professional articles with images, tags, and proper formatting. The creator, Pierre-Henry Soria, built this because he was tired of the content repurposing grind. Now you can sit back while AI does the heavy lifting.
Ready to turn your video library into an unstoppable written content machine? Let's dive deep.
What is pH-7/youtube-to-medium-blog-posts-automation?
pH-7/youtube-to-medium-blog-posts-automation is a Python-based automation pipeline that fetches YouTube video transcripts, intelligently rewrites them using OpenAI's GPT models, and publishes polished articles directly to Medium—all with minimal human intervention.
Created by Pierre-Henry Soria, a "super passionate engineer" obsessed with efficient content automation, this tool addresses a critical gap in the creator economy. Most "video to blog" tools spit out robotic transcripts that hemorrhage readers within seconds. Soria's script does something radically different: it understands context, removes filler speech, and reconstructs narratives that actually engage readers.
The project has gained serious traction because it solves three massive pain points simultaneously:
- Time bankruptcy: Creators spending 5-10 hours per article
- Quality degradation: Transcript tools producing unreadable garbage
- Platform fragmentation: No seamless YouTube → Medium workflow exists
What makes this especially powerful is its multi-niche architecture. Whether you're running a self-help channel in French, a tech tutorial series in English, or both—the script handles language detection, publication routing, and content optimization automatically. The "NextGen Dev: AI & Code" optimization for technical content shows Soria understands that developer audiences demand precision, not fluffy AI hallucinations.
The MIT-licensed project represents a shift in how serious creators think about content: one creation, infinite distribution. And with GPT-4.1 powering the transformations, the output quality rivals professional human writers—at roughly 1/100th the cost.
Key Features That Make This Insanely Powerful
This isn't another toy script. Here's what separates it from half-baked alternatives:
Intelligent Transcript Transformation
The script doesn't just clean transcripts—it reconstructs them. Using carefully engineered prompts, GPT-4.1 removes "transcript-like" writing (ums, ahs, temporal references like "as you can see here") and rebuilds proper narrative flow. The result reads like a native-written article, not a speech-to-text dump.
Multi-Language & Multi-Niche Architecture
Configure completely separate content pipelines:
- Self-help niche: French source → English + French output
- Tech niche: English source → English output with code-optimized prompting
- Extensible: Add unlimited niches with custom
config.jsonblocks
Automated Visual Enhancement
Articles die without visuals. The script:
- Fetches relevant Unsplash images (header + 1-2 content images)
- Embeds them in Medium-compatible Markdown
- Supports preferred photographer attribution for brand consistency
- Generates 5 SEO-optimized tags per article automatically
Smart Publishing Controls
- Draft-by-default safety (prevent embarrassing premature publishes)
- Configurable publish status for trusted workflows
- Automatic rate-limiting (waits between posts to avoid Medium spam flags)
- Publication routing to specific Medium publications by niche
Bulletproof Local Backup
Every generated article saves as a Markdown file with YAML metadata—your content archive remains independent of any platform. If Medium changes their API tomorrow, you own everything.
Transparent Error Handling
The terminal displays step-by-step progress with clear issue reporting. No silent failures, no wondering if your article vanished into the void.
Real-World Use Cases Where This Dominates
1. The Solo Creator Building an SEO Moat
You run a programming tutorial channel. Each video takes 10 hours to produce. With this script, every video automatically becomes a searchable Medium article capturing Google traffic your YouTube description never could. Compound this over 50 videos: that's 50 ranking articles working while you sleep.
2. The Multilingual Content Empire
Your self-help channel thrives in French, but you're ignoring the massive English-speaking market. Configure dual output languages, and one French video spawns both French and English articles—each properly localized, not awkwardly translated.
3. The Agency Scaling Client Content
Manage YouTube channels for 5 clients? This script lets you batch-transform entire channels into Medium publications. The multi-niche support means client content stays properly categorized and routed to correct publications.
4. The Course Creator Repurposing Legacy Content
Hundreds of old videos sitting dormant? Run the script against your archive and resurrect evergreen value. That 2019 Python tutorial becomes a 2024 Medium article with fresh Unsplash visuals—no re-recording required.
5. The Newsletter Writer Needing Source Material
Extract key insights from video interviews, automatically transformed into structured articles. Your newsletter research time collapses from 3 hours to 15 minutes of editing AI output.
Step-by-Step Installation & Setup Guide
Prerequisites
Before touching code, secure these credentials:
- Google account with YouTube Data API v3 enabled
- OpenAI API key with GPT-4.1 access
- Medium account with integration token
- Unsplash account for image API access
1. Clone and Enter the Repository
git clone https://github.com/pH-7/youtube-to-medium-blog-posts-automation.git &&
cd youtube-to-medium-blog-posts-automation
This creates your working directory and positions you for environment setup.
2. Create Isolated Python Environment
python3 -m venv .venv && source .venv/bin/activate
Critical on modern systems: PEP 668 prevents modifying system Python. Virtual environments eliminate dependency conflicts and keep your system clean. The && chains commands—environment creation and activation happen sequentially.
3. Install Dependencies
pip install -r requirements.txt
This pulls all required packages: YouTube API client, OpenAI SDK, Medium integration libraries, and helper utilities.
4. Configure Your Secrets
Create config.json in the project root:
{
"MEDIUM_ACCESS_TOKEN": "YOUR_MEDIUM_ACCESS_TOKEN",
"MEDIUM_EN_PUBLICATION_ID": "OPTIONAL_ENGLISH_PUBLICATION_ID",
"MEDIUM_FR_PUBLICATION_ID": "OPTIONAL_FRENCH_PUBLICATION_ID",
"MEDIUM_TECH_PUBLICATION_ID": "OPTIONAL_TECH_PUBLICATION_ID",
"POST_TO_PUBLICATION": true,
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
"OPENAI_MODEL": "gpt-4.1",
"UNSPLASH_ACCESS_KEY": "YOUR_UNSPLASH_KEY",
"PUBLISH_STATUS": "draft",
"NICHES": {
"self-help": {
"YOUTUBE_CHANNEL_ID": "YOUR_SELF_HELP_CHANNEL_ID",
"SOURCE_LANGUAGE": "fr",
"OUTPUT_LANGUAGES": ["en", "fr"],
"UNSPLASH_PREFERRED_PHOTOGRAPHER": "pierrehenry",
"ARTICLES_BASE_DIR": "articles"
},
"tech": {
"YOUTUBE_CHANNEL_ID": "YOUR_TECH_CHANNEL_ID",
"SOURCE_LANGUAGE": "en",
"OUTPUT_LANGUAGES": ["en"],
"UNSPLASH_PREFERRED_PHOTOGRAPHER": null,
"ARTICLES_BASE_DIR": "articles/tech"
}
},
"ACTIVE_NICHE": "all"
}
Key configuration decisions:
"PUBLISH_STATUS": "draft"— Never change to "publish" until you've verified output quality"OPENAI_MODEL": "gpt-4.1"— Non-reasoning models required; avoid o1/o3 series"ACTIVE_NICHE": "all"— Processes both niches; use"self-help"or"tech"for targeted runs
5. Configure YouTube API Access
Navigate to Google Developers Console:
- Create new project → Enable YouTube Data API v3
- Create OAuth 2.0 Client ID (Desktop application type, External user type)
- Download JSON → Save as
client_secrets.jsonin project root
6. Secure Unsplash Integration
Register at Unsplash Applications for your access key. This powers the visual enhancement that separates professional articles from text-only walls.
REAL Code Examples From the Repository
Let's examine the actual implementation patterns that make this script tick.
Example 1: The Core Transformation Pipeline
The main execution script orchestrates the entire workflow:
# transform-youtube-videos-to-medium-posts.py
# This is the entry point that coordinates all operations
python transform-youtube-videos-to-medium-posts.py
When executed, this triggers a 12-step pipeline:
- Loads configuration from
config.json - Authenticates with YouTube Data API using
client_secrets.json - Fetches recent videos based on
ACTIVE_NICHEfilter - Retrieves transcripts via YouTube's caption API
- Sends transcript to OpenAI with engineered rewrite prompts
- Generates SEO-optimized title separately
- Creates 5 relevant tags through dedicated prompt
- Queries Unsplash API for contextual images
- Assembles Medium-compatible Markdown with embedded images
- Posts to Medium (draft or publish per config)
- Saves local backup with YAML metadata
- Rate-limits before next iteration
The simplicity of invocation (python [script]) belies sophisticated orchestration underneath.
Example 2: Multi-Niche Configuration Architecture
The config.json structure reveals elegant extensibility:
{
"NICHES": {
"self-help": {
"YOUTUBE_CHANNEL_ID": "YOUR_SELF_HELP_CHANNEL_ID",
"SOURCE_LANGUAGE": "fr",
"OUTPUT_LANGUAGES": ["en", "fr"],
"UNSPLASH_PREFERRED_PHOTOGRAPHER": "pierrehenry",
"ARTICLES_BASE_DIR": "articles"
},
"tech": {
"YOUTUBE_CHANNEL_ID": "YOUR_TECH_CHANNEL_ID",
"SOURCE_LANGUAGE": "en",
"OUTPUT_LANGUAGES": ["en"],
"UNSPLASH_PREFERRED_PHOTOGRAPHER": null,
"ARTICLES_BASE_DIR": "articles/tech"
}
},
"ACTIVE_NICHE": "all"
}
Design brilliance here: Each niche is a self-contained configuration object with:
- Independent source channel (different YouTube channels)
- Language processing pipeline (source → output mapping)
- Visual branding control (preferred photographer or generic)
- Isolated file organization (separate output directories)
The "ACTIVE_NICHE" switch provides runtime control without code changes. Want to process only tech content during a focused work session? Change one string. No command-line flags, no environment variables—just declarative configuration.
Example 3: Customization Hooks for Power Users
The README exposes three critical customization points:
# Modify these in the source for fine-grained control:
# 1. Batch size control
maxResults # In get_videos_page function, within get_channel_videos
# 2. Article length tuning
max_tokens # In generate_article function
# 3. Tag quantity adjustment
# Modify the prompt in generate_tags function
Why this matters: The script ships with sensible defaults, but doesn't trap you. Processing a 3-hour deep-dive podcast? Bump max_tokens for comprehensive coverage. Running a news channel needing 10+ tags for discoverability? Tweak the prompt. These aren't buried in obscure classes—they're documented, named parameters in clearly identified functions.
The get_channel_videos → get_videos_page hierarchy suggests pagination handling for large channels. If you have 500+ videos, the script likely handles API pagination gracefully rather than choking on single-request limits.
Example 4: Safety-First Publishing Defaults
{
"PUBLISH_STATUS": "draft"
}
This single configuration choice reveals production-hardened thinking. The script could default to immediate publishing for "automation theater." Instead, it forces human review. Change to "publish" only after you've validated output quality across your specific content types. This protects your Medium publication reputation from accidental low-quality posts.
Advanced Usage & Best Practices
Prompt Engineering for Your Niche
The built-in prompts work generically, but customizing the system prompt in generate_article unlocks next-level results. For technical content, inject instructions like: "Preserve all code examples exactly. Use fenced code blocks with language identifiers. Explain complex concepts with analogies." For self-help: "Use conversational second-person. Include actionable takeaways in bold."
Publication Strategy Optimization
Don't dump everything at once. Configure PUBLISH_STATUS: "draft", then batch-schedule releases through Medium's native scheduler. This creates consistent publication rhythm without spamming followers.
Image Curation Workflows
The "UNSPLASH_PREFERRED_PHOTOGRAPHER" feature is underutilized gold. Find 2-3 photographers whose aesthetic matches your brand. Consistent visual identity across 50+ articles builds instant recognition in Medium feeds.
Cost Management
GPT-4.1 isn't free. For high-volume channels, consider:
- Processing only videos >30 days old (skip recent content you're manually promoting)
- Using
"gpt-4.1-mini"for initial drafts, then selective GPT-4.1 for high-performers - Implementing view-count thresholds (only transform videos with >X views)
Monitoring & Iteration
Track which transformed articles perform best. Feed those insights back into prompt adjustments. The script's local Markdown backups make A/B analysis trivial—compare metadata, tags, and structure across your top performers.
Comparison With Alternatives
| Feature | pH-7 Automation | Manual Transcription | Generic AI Writers | Descript/OpusClip |
|---|---|---|---|---|
| YouTube Integration | Native API | None | None | Limited |
| Transcript Quality | Rewritten narrative | Raw/robotic | Generic templates | Basic cleanup |
| Medium Publishing | Direct API | Manual paste | Manual paste | Manual paste |
| Multi-language | Built-in | Requires translator | Separate workflows | No |
| Multi-niche | Configurable | Manual organization | Account switching | No |
| Image Automation | Unsplash integration | Manual search | Manual search | Limited |
| Cost per article | ~$0.05-0.20 | $200-500 (writer) | $10-20 (SaaS) | $15-30 (SaaS) |
| Open source | ✅ MIT License | N/A | ❌ | ❌ |
| Customizable | Full code access | N/A | Limited | Limited |
The verdict: SaaS tools charge monthly subscriptions for fraction of this functionality. Manual workflows hemorrhage time and money. This script offers enterprise-grade automation at hobbyist cost—with complete transparency and zero vendor lock-in.
FAQ: Your Burning Questions Answered
Does this violate YouTube or Medium's terms of service?
The script operates within API guidelines for both platforms. However, always verify current ToS—the included disclaimer emphasizes educational use. Don't spam, respect rate limits, and ensure you own rights to transformed content.
Can I use this with videos I don't own?
Absolutely not. This is for repurposing your own content. Using others' transcripts without permission violates copyright and platform policies. The script is a productivity tool, not a content theft mechanism.
What if GPT-4.1 hallucinates technical details?
Always review drafts before publishing—especially code. The "draft" default exists for this reason. For critical technical content, consider adding validation steps or using the output as structured first drafts requiring expert review.
How do I handle channels with hundreds of videos?
The maxResults parameter controls batch size. Start small (5-10 videos), validate quality, then scale. The script's rate-limiting protects your Medium account from spam flags during large batches.
Can I publish to multiple Medium publications simultaneously?
Yes—configure separate MEDIUM_*_PUBLICATION_ID entries per niche. The script routes automatically based on your niche configuration. One run can populate multiple publications.
What Python version is required?
Python 3.7 or higher. The virtual environment setup ensures compatibility regardless of system defaults.
Is there support for other blogging platforms?
Currently Medium-focused, but the Markdown output format means manual portability to Substack, Dev.to, or Ghost. The architecture could extend to other APIs—contributions welcome!
Conclusion: Your Content Multiplier Awaits
The creator economy punishes single-platform thinking. Every video you publish without written repurposing is unrealized potential—traffic never captured, audiences never reached, revenue never generated.
pH-7/youtube-to-medium-blog-posts-automation eliminates the brutal tradeoff between quality and scale. It doesn't just convert content—it elevates it, transforming spoken wisdom into polished, discoverable, shareable articles that work tirelessly in search results.
Pierre-Henry Soria built this because he lived the pain. Now you don't have to.
Your move: Clone the repository today. Configure one niche. Run your first batch. Watch drafts appear that you'd proudly put your name on. Then scale.
The creators who master automated repurposing will dominate the next decade of content. Will you be among them?
☕ Loving this project? Buy Pierre-Henry an almond flat white—the fuel that builds automation magic.
⭐ Star the repository | 🍴 Fork to customize | 📺 Watch the demo