Skip to content
/ yt2mp3 Public

Download Youtube music video and convert to MP3

License

Notifications You must be signed in to change notification settings

l0n3m4n/yt2mp3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

badge

🎧 yt2mp3

📚 Table of Contents

Description

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."

🛠️ Installation

If virtual environment is not installed yet, follow to instruction below.

# installing python3 virtual environment
$ sudo apt install python3.11-venv
$ python3 -m pip install virtualenv 
$ python3 -m venv venv 
# cloning repository
$ git clone https://github.com/l0n3m4n/yt2mp3.git
$ cd yt3mp3 && source venv/bin/activate
$ pip install -r requirements.txt

⚙️ Usage

$ python3 yt2mp3.py -h, --help

              ,--.   ,---.                  ,----.  
    ,--. ,--.,-'  '-.'.-.  \,--,--,--.,---. '.-.  | 
    \  '  / '-.  .-' .-' .'|        || .-. |  .' <  
     \   '    |  |  /   '-.|  |  |  || '-' '/'-'  | 
    .-'  /     `--'  '-----'`--`--`--'|  |-' `----'  
    `---'                             `--'   
         💻 ALDrin / ⚔️ l0n3m4n / ⚙️ v1.0.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
  --url URL             YouTube video URL
  -o OUTPUT, --output OUTPUT
                        Output filename for MP3

Example usage: python3 yt2mp3.py --url https://www.youtube.com/watch?v=byCgohS7feE --output test.mp3
$ python3 yt2mp3.py --url https://www.youtube.com/watch?v=byCgohS7feE --output music_title.mp3
              ,--.   ,---.                  ,----.  
    ,--. ,--.,-'  '-.'.-.  \,--,--,--.,---. '.-.  | 
    \  '  / '-.  .-' .-' .'|        || .-. |  .' <  
     \   '    |  |  /   '-.|  |  |  || '-' '/'-'  | 
    .-'  /     `--'  '-----'`--`--`--'|  |-' `----'  
    `---'                             `--'   
         💻 ALDrin / ⚔️ l0n3m4n / ⚙️ v1.0.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.

💁 References

  • 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!

📝 Todo

  • Adding progress bar
  • Add multiple URL
  • Extract mp3 Metadata (forensic purpose)
  • Adding song title automatically
  • GUI integration, flask, tkinker
  • UI design, additional features

📌 Author

👨🏾‍⚖️ License

This project is under terms of the MIT License. For fixing Bugs, create issue