A simple Python script that downloads YouTube videos or audio using yt-dlp.
This tool relies on YouTube, which may change or restrict access at any time. Use it at your own risk, downloading content may also be subject to YouTube's Terms of Service depending on your use case.
- Download videos as MP4
- Download audio as MP3
- Choose the video quality before downloading
- Download subtitles (manual or automatic)
- Python 3.10+
- FFmpeg
- yt-dlp
pip install yt-dlpwinget install FFmpegAfter installation, restart your terminal if needed.
python ytdl.py <youtube_url> <format>python ytdl.py "https://youtu.be/VIDEO_ID" mp4The script will:
- Display all available video qualities.
- Ask which quality you want.
- Ask whether you want subtitles.
- Download and merge the video into an MP4 file.
python ytdl.py "https://youtu.be/VIDEO_ID" mp3The script downloads the best available audio and converts it to MP3.
Downloaded files are saved in the same directory as the script.
Examples:
My Video.mp4
My Song.mp3
My Video.en.vtt
- If subtitles are available, you can choose one or more language codes (for example:
en,fr,ar). - Press Enter when asked for a quality to download the best available quality.
- Press Enter when asked for subtitle languages to download all available subtitle languages.
- Some videos may not provide subtitles or may have automatic captions only.
- If YouTube temporarily rate-limits subtitle downloads (
HTTP 429), wait a while and try again.
This project is currently under development.
- ✅ Download YouTube videos as MP4
- ✅ Download YouTube audio as MP3
- ✅ Interactive video quality selection
- ✅ Automatic video/audio merging with FFmpeg
- 🚧 Subtitle download support (work in progress)
Note: Video and audio downloads are fully functional. Subtitle downloading is still being improved and may not work correctly for every video due to YouTube restrictions or rate limits.
- MP4 video downloads
- MP3 audio extraction
- Quality selection
- FFmpeg integration
- Interactive command-line interface
- Reliable subtitle downloading
- Better subtitle language selection
- Improved error handling
- Playlist support
- Download progress improvements
- Batch downloads
- Custom output directory
- Download thumbnails
- Metadata embedding
- Configuration file support
This project is open source under the MIT License.