A powerful Python tool that converts entire YouTube playlists into well-formatted markdown files. Perfect for creating transcripts, documentation, research notes, or archiving video content in a readable format.
- π Batch Processing: Process entire YouTube playlists with a single command
- π Smart Transcription: Multiple transcription methods with automatic fallback
- π Rich Metadata: Includes video title, channel, duration, views, and more
- π Resume Support: Skip already processed videos to save time
- π― Flexible Output: Choose between transcription, summary, or outline modes
- πΎ Clean Markdown: Well-formatted output with proper headings and metadata
The tool uses a smart multi-method approach:
-
YouTube Transcript API (fastest, no API limits)
- Fetches existing captions/subtitles
- No token consumption
- Works when captions are available
-
Google Gemini API (direct video processing)
- Processes videos without captions
- High-quality transcription
- May have token limits for long videos
-
Audio Download + Gemini (for long videos)
- Downloads audio first
- Processes in chunks
- Handles videos that exceed API limits
- Python 3.7+
yt-dlporyoutube-dlcommand-line tool- Google Gemini API key
- Clone the repository:
git clone https://github.com/yourusername/youtube-playlist-to-markdown.git
cd youtube-playlist-to-markdown- Install Python dependencies:
pip install -r requirements.txt- Install yt-dlp (recommended) or youtube-dl:
# Using pip
pip install yt-dlp
# Or using homebrew (macOS)
brew install yt-dlp
# Or download directly
# https://github.com/yt-dlp/yt-dlp#installation- Set up your API key:
cp .env.example .env
# Edit .env and add your Gemini API key- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and add it to your
.envfile
Process an entire YouTube playlist:
python youtube_playlist_to_markdown.py https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID# Process as summaries instead of full transcripts
python youtube_playlist_to_markdown.py PLAYLIST_URL --mode summarize
# Process only videos 5-10 from the playlist
python youtube_playlist_to_markdown.py PLAYLIST_URL --start 5 --end 10
# Skip videos that already have output files
python youtube_playlist_to_markdown.py PLAYLIST_URL --skip-existing
# Custom output directory
python youtube_playlist_to_markdown.py PLAYLIST_URL --output-dir my_transcripts
# Add delay between videos (in seconds)
python youtube_playlist_to_markdown.py PLAYLIST_URL --delay 5
# Force a specific transcription method
python youtube_playlist_to_markdown.py PLAYLIST_URL --force api # or gemini, ytdlpAfter processing, you can enhance the transcripts with metadata:
python convert_transcripts_to_markdown.py transcript_folder/This adds:
- Video metadata (views, likes, upload date)
- Proper formatting and structure
- Clickable video links
- Channel information
The tool creates organized output:
20250621_PlaylistName_transcribe/
βββ 00_playlist_summary.md # Overview of all videos
βββ VideoID1_transcribe.txt # Raw transcript
βββ VideoID2_transcribe.txt
βββ ...
20250621_PlaylistName_transcribe_markdown/
βββ VideoID1_transcribe.md # Enhanced markdown
βββ VideoID2_transcribe.md
βββ ...
Each markdown file includes:
# Video Title
## Video Information
- **URL**: [https://youtube.com/watch?v=...](...)
- **Channel**: Channel Name
- **Published**: January 1, 2024
- **Duration**: 15m 30s
- **Views**: 1,234,567
- **Likes**: 12,345
## Description
Video description here...
## Transcript
Full transcript or summary content...- transcribe: Full word-for-word transcript
- summarize: Concise summary of key points
- outline: Structured outline of main topics
- Ensure the playlist is public
- Check the playlist URL is correct
- Try using the playlist ID directly
- Verify your Gemini API key is correct
- Check you have API access enabled
- Ensure you haven't exceeded quota limits
- Some videos may not have captions available
- The tool will automatically try alternative methods
- Check the playlist summary for any failed videos
- Make sure you have Python 3.7 or newer
- Try upgrading pip:
python -m pip install --upgrade pip - On macOS/Linux, you might need to use
python3instead ofpython
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Uses the excellent youtube-transcript-api library
- Powered by Google's Gemini AI for transcription
- Built with yt-dlp for video information
This tool is for educational and personal use. Please respect copyright laws and YouTube's Terms of Service when using this tool. Always ensure you have the right to transcribe and store content from YouTube videos.