A simple Python script for downloading audio from YouTube music using yt-dlp
and ffmpeg
. This script supports both downloading from a file (like a list) containing YouTube links and inline downloading from a single video URL.
- Download audio from YouTube or Youtube Music in MP3 format.
- Supports downloading from a file with multiple YouTube links.
- Inline downloading for single YouTube video URLs.
- Dependency check at startup
- Option to log errors and other information.
- CLI-based menu for easy user interaction.
- Python 3.7+
yt-dlp
libraryffmpeg
installed on your system
You can install yt-dlp
using pip
:
pip install yt-dlp
Using winget:
winget install "FFmpeg (Essentials Build)"
Using chocolatey:
choco install ffmpeg
sudo apt install ffmpeg
brew install ffmpeg
Running the Script To run the script, execute the Python file:
python ytmp3.py
-
Download from a file containing YouTube links: You will be prompted to enter the file path containing YouTube links (one per line).
-
Download a single YouTube video by URL: Enter the YouTube video URL, and the script will download the audio.
-
Exit: Close the script.
You can enable logging for detailed information or hide all output except errors by answering the prompt during the CLI menu. Logs will be displayed in the console, and errors will be captured and logged if anything goes wrong.
If an error occurs during the download process, the script will log the error and continue with the next download, if applicable. You will be given the option to view the errors after each download.
On startup, the script will check if yt-dlp and ffmpeg are installed. If they are outdated, the script will show a warning, but you can continue with the program.
Feel free to fork this repository and submit pull requests. If you find any issues or have suggestions for improvements, open an issue or contact me directly.
This project is licensed under the MIT License - see the LICENSE file for details.