A useful youtube-dl wrapper to download music
Install the yt-dlp and music-tag packages:
pip3 install yt-dlp
pip3 install music-tagSpecify the songs to download. This is done using a csv file with these columns:
urlartisttitlealbum
The columns are separated with a "|" and the first line of the file must be like this:
url|artist|title|album
The album column can be empty (but you have to keep the | at the end).
Multiple artists can be specified by separating them with &&.
See example.csv for an example.
You then run the script like this:
python3 download.py <filename>The downloaded files are automatically converted to OGG/Vorbis and tagged properly.
Some Python installations nowadays (such as in Debian) complain when you try to install PIP packages globally.
To make invoking the script with a virtual environment easier, there is a download.sh script which activates the virutal environment (must be named venv) and runs download.py.
Practical example:
python3 -m venv venv
. venv/bin/activate
pip3 install yt-dlp
pip3 install music-tag
# in a different terminal
./download.sh list.csvThe script even works when being symlinked to, so you don't have to clutter your music directory with the venv:
ln -s <repo path>/download.sh ~/Music/download.sh
cd ~/Music
./download.sh list.csv