Download YouTube videos as MP3 or MP4 from the command line
Project description
Python Youtube Downloader
A simple command-line application to download YouTube videos as MP3 (audio) or MP4 (video). Optionally saves to an external drive.
Prerequisites
- 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
- macOS:
Installation
Option A: pip (Python package)
Install with pip so the youtube-downloader command is available. This also installs yt-dlp for you.
pip install python-youtube-downloader
# or into your user directory (available in any terminal):
pip install --user python-youtube-downloader
Then run:
youtube-downloader
Where pip installs: With pip install, the package goes into your active Python environment (e.g. your conda env or site-packages). With pip install --user, it installs into your user directory so the command is available in any terminal. You still need ffmpeg installed on your system for MP3/MP4 conversion.
Option B: npm (global CLI)
Install globally and run from anywhere (uses Node to run the Python script):
npm install -g python-youtube-downloader
Then use:
youtube-downloader
# or
python-youtube-downloader
If you install with both pip and npm: Both register a youtube-downloader command. Whichever directory comes first in your PATH runs (no crash). Pick one install method if you want to avoid ambiguity.
Option C: From source
- Clone or download this repository.
- Install the required Python library:
pip install yt-dlp
Prerequisites: Python 3, yt-dlp (installed automatically with pip option), and ffmpeg (for MP3/MP4 conversion).
Usage
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.
python downloader.py
# or, if installed via npm:
youtube-downloader
Or with link and format:
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_youtube_downloader-1.0.0.tar.gz.
File metadata
- Download URL: python_youtube_downloader-1.0.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d80ec7eb0d45c9e19ea55dc5d6245e9b0fa3165db6228820e90828537e7f5f7
|
|
| MD5 |
a22ebaafe24da5664314ce83d2ff591a
|
|
| BLAKE2b-256 |
6aee993004291ac9649e699be3fe5af883c1e2e293ddf66d9d8a7fe943106ca8
|
File details
Details for the file python_youtube_downloader-1.0.0-py3-none-any.whl.
File metadata
- Download URL: python_youtube_downloader-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f7b7539fed7486d9dedb02f71b2ae252b0c85d28b923ff4d20682467aa38988
|
|
| MD5 |
fb0e3bce6437ca52b35f485307cb12c0
|
|
| BLAKE2b-256 |
a0783c08a034ecea3888b88d4dd31d99cf150131ee089f70cf63019abac3033a
|