Skip to content

rwxce/yt-playlist-to-mp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YT Playlist to MP3

YT Playlist to MP3 is a lightweight Python utility that downloads audio from YouTube videos or playlists and automatically converts them to high-quality MP3 files using yt-dlp and FFmpeg.

The tool provides a simple CLI workflow that allows downloading either:

  • a single video
  • a full playlist

and converts the extracted audio to MP3 while storing the results in a structured local directory.


Features

Playlist download

Download all videos from a YouTube playlist and convert them to MP3.

Single video support

Download and convert individual YouTube videos.

Automatic audio extraction

Uses yt-dlp to extract the best available audio stream.

MP3 conversion

Uses FFmpeg to convert audio to high-quality MP3.

Cookie support

Allows reading cookies from your browser to bypass YouTube restrictions when needed.

Simple CLI interface

Interactive menu for quick use without command-line parameters.


Requirements

The tool depends on the following components:

  • Python 3.10+
  • yt-dlp
  • FFmpeg
  • Optional: Node.js (recommended for modern YouTube extraction)

Installation

1. Clone the repository

git clone https://github.com/rwxce/yt-playlist-to-mp3.git
cd yt-playlist-to-mp3

2. Create a virtual environment

Linux / macOS

python -m venv venv
source ./venv/bin/activate

Windows (Git Bash)

python -m venv venv
source ./venv/Scripts/activate

Windows (PowerShell)

python -m venv venv
.\venv\Scripts\Activate.ps1

3. Install dependencies

pip install -r requirements.txt

The project currently requires:

yt-dlp

Installing FFmpeg

FFmpeg is required to convert downloaded audio into MP3 format.

Windows

Install using winget:

winget install Gyan.FFmpeg

Verify installation:

ffmpeg -version

Linux

Debian / Ubuntu

sudo apt update
sudo apt install ffmpeg

Fedora

sudo dnf install ffmpeg

Arch Linux

sudo pacman -S ffmpeg

Verify installation:

ffmpeg -version

macOS

Install using Homebrew:

brew install ffmpeg

Verify installation:

ffmpeg -version

If FFmpeg is not installed, yt-dlp will download the audio but will not be able to convert it to MP3.


Installing Node.js (recommended)

Newer versions of YouTube sometimes require a JavaScript runtime.

Install Node.js:

winget install OpenJS.NodeJS.LTS

Verify:

node -v

Usage

Run the program:

python main.py

You will see the menu:

Welcome to the Youtube Downloader
1) Playlist
2) Single Video

Cookies (optional)

If YouTube blocks the download, you can load cookies from your browser.

Example input:

chrome
firefox
edge

Leave empty to skip.


Output structure

Downloaded files are stored in:

result/Jazz/

Example output:

result/
└── Jazz/
    ├── Autumn Leaves.mp3
    ├── So What.mp3
    └── Blue in Green.mp3

Files are automatically converted to MP3.

By default, downloaded files are saved in:

result/Jazz/

You can change the genre folder name in the script to organize downloads by music style.


Project Structure

YT Playlist to MP3/
│
├── main.py
├── requirements.txt
├── README.md
│
└── result/
    └── Jazz/

How It Works

The script internally runs:

yt-dlp --extract-audio --audio-format mp3

Workflow:

YouTube
   ↓
yt-dlp downloads audio stream
   ↓
FFmpeg converts audio → MP3
   ↓
File saved locally

Intended Use

This project is intended for:

  • Personal offline music listening
  • Educational purposes
  • Automation of playlist downloads
  • Archiving publicly available audio content

Disclaimer

Users are responsible for complying with YouTube Terms of Service and copyright laws.

This tool is intended for personal and educational use only.


License

This project is licensed under the MIT License.

See the LICENSE file for details.


Contributing

Contributions are welcome.

Possible improvements:

  • Automatic playlist folder naming
  • Metadata tagging (artist/title)
  • Progress bar UI
  • Parallel downloads
  • CLI argument support

About

Python tool to download audio from YouTube videos or playlists and automatically convert it to MP3 using yt-dlp and FFmpeg.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages