Skip to main content

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

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

  1. Clone or download this repository.
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_youtube_downloader-1.0.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_youtube_downloader-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file python_youtube_downloader-1.0.0.tar.gz.

File metadata

File hashes

Hashes for python_youtube_downloader-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9d80ec7eb0d45c9e19ea55dc5d6245e9b0fa3165db6228820e90828537e7f5f7
MD5 a22ebaafe24da5664314ce83d2ff591a
BLAKE2b-256 6aee993004291ac9649e699be3fe5af883c1e2e293ddf66d9d8a7fe943106ca8

See more details on using hashes here.

File details

Details for the file python_youtube_downloader-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for python_youtube_downloader-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f7b7539fed7486d9dedb02f71b2ae252b0c85d28b923ff4d20682467aa38988
MD5 fb0e3bce6437ca52b35f485307cb12c0
BLAKE2b-256 a0783c08a034ecea3888b88d4dd31d99cf150131ee089f70cf63019abac3033a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page