This mpv script uses the mpv console input to search YouTube or YouTube Music and add the results to the mpv playlist.
This script requires mpv 0.38.0 or greater, for older versions of mpv see the mpv-v0.37.0 branch.
- Install yt-dlp.
- In your mpv
configdirectory, addyoutube-search.luatoscriptsand (optionally) addyoutube-search.conftoscript-opts(create the directories if they do not exist).
Add the following to your flake inputs:
mpv-youtube-search.url = "github:willswats/mpv-youtube-search";You can then use the package with:
inputs.mpv-youtube-search.packages.${pkgs.system}.mpv-youtube-searchFor example, with Home Manager:
{ inputs, pkgs, ... }:
{
programs.mpv = {
enable = true;
scripts = with pkgs; [
inputs.mpv-youtube-search.packages.${pkgs.system}.mpv-youtube-search
];
};
}Change the values inside of youtube-search.conf to configure the script.
To add the key bindings to your input.conf (change i to your desired key):
i script-binding youtube_search/youtube_search_replace
i script-binding youtube_search/youtube_music_search_replace
i script-binding youtube_search/youtube_search_append
i script-binding youtube_search/youtube_music_search_append
i script-binding youtube_search/search_results_update
ALT+s - Open the input for searching YouTube (replace playlist)
ALT+S - Open the input for searching YouTube Music (replace playlist)
Alt+a - Open the input for searching YouTube (append to playlist)
ALT+A - Open the input for searching YouTube Music (append to playlist)
ALT+r - Open the input for setting the number of search results (does not work with YouTube Music)