Package: vidl
vidlvidl is a script designed to easily download video/audio from anywere, using yt-dlp. It automatically embeds thumbnails to mp3/mp4/m4a files.vidl will add metadata to mp3 files if it's found. The--no-mdoption turns this off.title,artistandyearmetadata is added, but if the URL is a playlist, it also addsalbum,album artist,track number,track count.
If the title contains " - ", vidl often uses what comes before and after it as artist and title respectively. The--dont-extract-mdoption turns off this behaviour.InstallationInstall Python (3.7+ is recommended)Installffmpeg and ffprobeRunpip3 install vidl.If you're not on macOS or Windows, you need to specify where vidl will download files to in your vidl config file. Runvidl --config-pathto see where the config file is.
If you're on macOS, I recommendsetting up shortcuts for vidlUpdatingvidl is updated by runningpip3 install vidl --upgrade --upgrade-strategy eager.
If vidl is unable to download a URL, it might be because yt-dlp is outdated. The--upgrade-strategy eagerpart updates yt-dlp.UninstallRunpip3 uninstall vidl.To fully uninstall vidl, go to vidl's config file (Runvidl --config-pathto see where it is) and delete the folder it's in.UsageExamples:vidl https://www.youtube.com/watch?v=ta_ZVS7HkwIDownloads the video as mp3, and adds metadata it detects.vidl mp3 https://www.youtube.com/watch?v=ta_ZVS7HkwI --no-mdDownloads the video as mp3, without adding metadata.vidlPrints vidl's help menu, which looks like this:Download Usage:
    vidl [format] [options] <URL>

Download Options:
    format             bestvideo, bestaudio (default), mp3, mp4, wav, m4a, or opus
    --no-md            Don't add metadata to downloaded files
    --no-smart-md      Don't extract artist and song name from title
    --no-embed         Don't embed thumbnail
    --no-dl            Don't download anything. Usually used with -v
    -v, --verbose      Display all logs

General Options:
    --version          Show version. vidl -v and vidl version works too
    -h, --help         Show this help message. vidl help works too
    --config-path      Show the location of the configuration file

Update:
    pip3 install vidl --upgrade --upgrade-strategy eagerConfigurationvidl has a configuration file, which you can find the location of by runningvidl --config-path. In it, you can set the download folder and filename template.If you screw something up, you can delete the file, and the default will be recreated the next time you run vidl.Custom metadata parsingvidl has auser_md_parser.pyfile. By default, it does nothing, but you can configure it to manipulate metadata of songs you download however you like. In my case, I set the "Comment" metadata to "NCS" if the title ends with "[NCS Release]".Documentation for this can be found in the file itself. The file is in the same folder as vidl's config file, which you can find by by runningvidl --config-path. If you screw something up, you can delete the file, and the default will be recreated the next time you run vidl.Set up shortcuts for vidl (macOS)You'll be able to select any piece of text, press your chosen shortcut and the link(s) in your selected text will be downloaded! A little tedious to set up, but well worth it.First, we need to create a macOS Service:Open the Automator app.Choose File > New, and select Service.(TLDR; AddRun Shell Script) In the window that just popped up, there are two columns on the left (if not, click theLibrarybutton in the status bar). SelectUtilitiesin the first column, and in the second column, dragRun Shell Scriptinto the main part of the window.Make your settings match these:If you want the shortcut to only work in one app, select that app instead ofany application.In the text box in the "Run Shell Script" box, paste in the following script:forfin"$@"do# behave like a normal terminal window:exportPATH=/usr/local/bin:$PATHsource~/.bash_profilevidl"$f"doneChoose File > Save. Type in vidl.Almost done, you just need to tie a shortcut to the macOS Service you just created:Open the System Preferences app.Go to Keyboard and select the Shortcuts tab.Select Services from the left column, and locate vidl (should be under Internet). Add your preferred shortcut.API UsageYou can use Python to download a URL. Example:fromvidlimportconfig,dldefmain():config.verify_config()dl.download({# all options are required'url':'https://www.youtube.com/watch?v=82IZ63TU8Fs''file_format':'mp3','audio_only':True,'no_md':False,'no_thumbnail_embed':False,'no_smart_md':False,'no_dl':False,'verbose':False,'download_folder':config.get_config('download_folder'),'output_template':config.get_config('output_template'),})main()Dev InstructionsDev InstallationInstall Python. You may want to install it usingpyenvin order to manage Python versions (If Poetry doesn't detect the right version, you can fix it with pyenv).Installffmpeg and ffprobeInstallPoetryRunpoetry installto install Python package dependencies.If you're not on macOS or Windows, you need to specify where vidl will download files to in your vidl config file. Runvidl --config-pathto see where the config file is.I recommend runningpoetry config virtualenvs.in-project true, which makes Poetry store your Python virtual environment inside the project folder. Additionally, it lets VSCode's Python extension detect the virtual environment if you set thepython.pythonPathsetting to${workspaceFolder}/.venv/bin/pythonin your settings.Runningpoetry run vidlAn alternative topoetry run <command>is to runpoetry shellto enter the virtual environment's Bash CLI, and then run the command on it's own (e.gvidl).Releasing a new versionFirst of all, consider updating the lockfile dependencies by runningpoetry update, then check if things still work.Bump the version number.<version>can bepatch,minor,majoror a version number:poetry version <version>Update CHANGELOG.mdBuild:poetry buildCommit and create a git tagCreate GitHub release with release notes and attach the build filesPublish to PyPI:poetry publish