Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

MPV, youtube-dl and web browsers

Stream videos (or audio) with 2 clicks?



cp /usr/share/applications/mpv.desktop ~/.local/share/applications/mpvv.desktop

Exec=mpv --no-cache -- "$(xsel -b)"

Audio only (with thumbnail)

cp /usr/share/applications/mpv.desktop ~/.local/share/applications/mpva.desktop

Exec=mpv --ytdl-format=bestaudio --loop --no-sub-auto --no-stop-screensaver --no-config --script-opts=osc-visibility=always --external-files-append "$(youtube-dl --get-thumbnail "$(xsel -b)")" --autofit-smaller=960x480 -- "$(xsel -b)"

Download music?

cp /usr/share/applications/mpv.desktop ~/.local/share/applications/mpvd.desktop

Exec=st -g 100x20 -e youtube-dl -xf bestaudio -o '~/Music/%(title)s.%(ext)s' -- "$(xsel -b)"

depending on the terminal emulator formatting of -o may be problematic

Add to your panel(s), Copy Link Location and click


  • icons/breeze/actions/22/
  1. im-youtube.svg
  2. kdenlive-show-video.svg
  • icons/breeze/places/22/
  1. folder-download.svg
  2. folder-music.svg

Icon=/usr/share/icons/breeze-dark/actions/22/im-youtube.svg or Icon=im-youtube.svg


or just add st mpv --ytdl-format=bestaudio -- $(xsel -b) as a keyboard shortcut to your window manager

or something like this


sselp can be used with Firefox which populates both primary and clipboard


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment