yt2mp3 is a small project cli music downloader from youtube and convert into mp3 using pytube, moviepy and tqdm python libraries.
"Converting YouTube videos on third party websites carries high risks, hackers can embed executable code or scripts within MP3 files. When you play or open such file, it could potentially execute malicious code and compromise your system."
๐ Table of Contents
- ๐ Description
- ๐ ๏ธ Installation
- โ๏ธ Usage
- ๐ References
Installing virtual environment
$ sudo apt install python3.11-venv
$ python3 -m pip install virtualenv
$ python3 -m venv venv
$ git clone https://github.com/l0n3m4n/yt2mp3.git
$ cd yt3mp3 && source venv/bin/activate
$ pip install -r requirements.txt
$ python3 yt2mp3.py -h, --help
__ ______ ______
.--.--.| |_|__ |.--------.-----.|__ |
| | || _| __|| | _ ||__ |
|___ ||____|______||__|__|__| __||______|
|_____| |__|
Author: l0n3m4n | โ๏ธ v1.1
usage: yt2mp3.py [-h] [--url URL] [-o OUTPUT]
Download a YouTube video and convert to MP3.
options:
-h --help Show this help message and exit
-u --url YouTube video URL
-o --output Output filename for MP3
Ex: python3 yt2mp3.py -u https://www.youtube.com/watch?v=id -o music_title.mp3
$ python3 yt2mp3.py --url https://www.youtube.com/watch?v=byCgohS7feE --output music_title.mp3
__ ______ ______
.--.--.| |_|__ |.--------.-----.|__ |
| | || _| __|| | _ ||__ |
|___ ||____|______||__|__|__| __||______|
|_____| |__|
Author: l0n3m4n | โ๏ธ v1.1
๐ฅ Downloading video...
Progress: 100%|############################| 3.67M/3.67M [00:00<00:00, 9.25MB/s]
๐พ Video downloaded.
๐ต Converting to MP3...
Progress: 0%|##########################################| 0/179.05 [00:07<?, ?s/s]
๐ฝ Conversion complete. MP3 saved at: ./music/music_title.mp3
๐ฎ Temporary video file deleted.
- pytube is a genuine, lightweight, dependency-free Python library (and command-line utility) for downloading YouTube videos.
- Moviepy allows to extract audio from a video file (like MP4) and save it as an audio file (like MP3).
- tqdm Instantly make your loops show a smart progress meter - just wrap any iterable with tqdm(iterable), and youโre done!
-
Adding progress bar - Add multiple URL
- Extract MP3 metadata
- Adding song title automatically
This project is under terms of the MIT License. For fixing Bugs, create issue