Download YouTube videos as MP3 or MP4 from the command line
npm install python-youtube-downloaderA simple command-line application to download YouTube videos as MP3 (audio) or MP4 (video). Optionally saves to an external drive.
- Python 3.x
- yt-dlp: Installed via pip install yt-dlp
- ffmpeg: Required for audio conversion.
- macOS: brew install ffmpeg
- Windows: Download from ffmpeg.org and add to PATH.
- Linux: sudo apt install ffmpeg
Install globally and run from anywhere:
``bash`
npm install -g python-youtube-downloader
Then use:
`bash`
youtube-downloaderor
python-youtube-downloader
1. Clone or download this repository.
2. Install the required Python library:
`bash`
pip install yt-dlp
Prerequisites (for both options): Python 3, yt-dlp (pip install yt-dlp), and ffmpeg (for MP3/MP4 conversion).
Run the script and enter the YouTube URL when prompted. Choose MP3 (audio only) or MP4 (video). If an external drive named SWIM PRO is connected, files are saved there; otherwise they go to the current folder.
`bash`
python downloader.pyor, if installed via npm:
youtube-downloader
Or with link and format:
`bash``
python downloader.py "https://youtu.be/VIDEO_ID" mp3
python downloader.py "https://youtu.be/VIDEO_ID" mp4
youtube-downloader "https://youtu.be/VIDEO_ID" mp4