Simple CLI application to download, convert to MP3 format, and add metadata information. Metadata information include
- Title
- Artist
- Album Artist
- Genre
- Album Artwork
You need
ffmpeg
encoder installed in your machine in order for the following scripts to work
- youtube_converter.py
- youtube_metadata.py
- Updating Metadata using Python's eyed3 library
- Youtube to MP3 converter python script
- Intro to Pytube - Freecodecamp
- Youtube DL tutorial
- Convert Audio .wav to .mp3 using ffmpeg
- Youtube DL python script
- Youtube to MP3 using nodejs
- Medium - convert .wav to .mp3
- Create a folder to save mp3 files -
download
- From the root folder, run
uv run main.py
- Clone / Download the ZIP version into your local machine
- Create folder to save mp3 files -
download
- Setup a Local environment using
python -m venv venv --prompt="utump3(3.11)"
- Activate the virtual environment
# For Macbook
source ./venv/Scripts/activate
# For windows
./venv/Scripts/activate.bat
- Run the following to install dependant libraries
pip install -r requirements.txt
Read more about the error in the link below -NoneType object has no attribute span
I just patched this error by simply modifying venv/.local/lib/python3.7/site-packages/pytube/cipher.py Line 411
transform_plan_raw = find_object_from_startpoint(raw_code, match.span()[1] - 1)
to
transform_plan_raw = js
And everything works fine. Hope this can solve your problem. Thank you very much! It worked perfectly here. I have no idea how this change fixed the bug (if you want to explain that would be great), but it worked perfectly anyway.
You need to convert the downloaded file to an Actual
MP3 audio file. Run the following script from terminal
# s - source path (source location of the media file)
# d - destination path (where you want the converted file to reside)
python3 ./youtube_converter.py -s ./download/harry_potter.mp3 -d ./download/harry_potter_convert.mp3
In order to add metadata information (including artwork file) run the following script from terminal
# m - path to the mp3 file
# a - path to the artwork file (optional)
python3 ./youtube_metadata.py -m ./download/harry_potter_ea_games_soundtrack_convert.mp3 -a ./download/harry_potter.jpeg