A simple, standalone Python application to extract transcripts from YouTube videos. No web server required - just run it directly from your terminal!
- Extract transcripts from any YouTube video with closed captions
- Support for multiple YouTube URL formats (standard, shorts, live, embedded, youtu.be)
- Batch processing - extract transcripts from multiple videos at once
- Automatic language detection with English preference
- Clean, formatted output with natural paragraph breaks
- Optional video metadata (title, duration, uploader)
- Flexible output options (console, file, or auto-generated filenames)
- Clone or download this repository
- Install the minimal dependencies:
pip install -r requirements.txtThat's it! Only 2 dependencies:
youtube-transcript-api- for extracting transcriptsyt-dlp- for fetching video metadata
Extract transcript and display in console:
python youtube_transcriber.py https://www.youtube.com/watch?v=VIDEO_IDSave transcript to a specific file:
python youtube_transcriber.py https://youtu.be/VIDEO_ID -o transcript.txtAuto-generate filename based on video title:
python youtube_transcriber.py VIDEO_ID -o autoCreate a file with URLs (one per line):
# urls.txt
https://www.youtube.com/watch?v=VIDEO1
https://youtu.be/VIDEO2
https://youtube.com/shorts/VIDEO3
Process all URLs and save to a directory:
python youtube_transcriber.py -b urls.txt -d output_folderExclude metadata from output:
python youtube_transcriber.py URL --no-metadataSuppress progress messages:
python youtube_transcriber.py URL -q --quietThe tool supports all common YouTube URL formats:
- Standard:
https://www.youtube.com/watch?v=VIDEO_ID - Short:
https://youtu.be/VIDEO_ID - Shorts:
https://youtube.com/shorts/VIDEO_ID - Live:
https://www.youtube.com/live/VIDEO_ID - Embed:
https://www.youtube.com/embed/VIDEO_ID - Mobile:
https://m.youtube.com/watch?v=VIDEO_ID - Direct video ID:
VIDEO_ID
positional arguments:
url YouTube URL or video ID
options:
-h, --help Show help message
-o, --output Output file (use "auto" for automatic naming)
-d, --output-dir Output directory for batch processing
-b, --batch Process URLs from file (one per line)
--no-metadata Exclude video metadata from output
-q, --quiet Suppress progress messages
python youtube_transcriber.py dQw4w9WgXcQpython youtube_transcriber.py https://www.youtube.com/watch?v=dQw4w9WgXcQ -o "rick_roll_transcript.txt"# Process multiple videos and save each to a separate file
python youtube_transcriber.py -b video_list.txt -d transcripts/# Just the transcript, no metadata, saved to file
python youtube_transcriber.py VIDEO_ID --no-metadata -o clean.txtWith metadata (default):
================================================================================
Title: Video Title Here
Uploader: Channel Name
Duration: 10:35
URL: https://www.youtube.com/watch?v=VIDEO_ID
================================================================================
This is the transcript text formatted into natural paragraphs. Each paragraph
contains multiple sentences grouped logically together.
Another paragraph continues here with the next part of the transcript...
Without metadata (--no-metadata):
This is the transcript text formatted into natural paragraphs. Each paragraph
contains multiple sentences grouped logically together.
Another paragraph continues here with the next part of the transcript...
The tool provides clear error messages:
- Invalid URL format
- Video without available transcripts
- Network issues or YouTube blocking
- File access problems
- Auto-naming: Use
-o autoto automatically generate filenames based on video titles - Batch files: Lines starting with
#in batch files are treated as comments - Language fallback: If English transcript isn't available, the tool will use the first available language
- Rate limiting: If processing many videos, add delays between requests to avoid YouTube blocking
- The video doesn't have closed captions enabled
- The video is private or age-restricted
- Live stream is still ongoing (transcripts only available after stream ends)
- You've made too many requests - wait a while before trying again
- Consider using a VPN or proxy
- Add delays between batch requests
- Check the URL format is correct
- Ensure the video still exists and is public
- Python 3.8+
- youtube-transcript-api
- yt-dlp
This is a standalone tool for personal use. Please respect YouTube's Terms of Service and content creators' rights when using extracted transcripts.