Last active
October 17, 2025 22:06
-
-
Save viliampucik/94cab9cb76246eac7b1dc64cd247bd81 to your computer and use it in GitHub Desktop.
MPV YouTube
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ytdl-format=bestvideo[ext=mp4][height<=1080]+bestaudio/best[ext=mp4]/best |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name MPV YouTube | |
| // @namespace vip | |
| // @match https://www.youtube.com/* | |
| // @grant none | |
| // ==/UserScript== | |
| var p = document.getElementById("player"); | |
| if (p) { | |
| p.addEventListener("click", function(e){ | |
| e.stopPropagation(); | |
| var list = document.getElementsByClassName("html5-video-player"); | |
| if (list.length) { | |
| var rect = list[0].getBoundingClientRect(); | |
| var geometry = `${rect.width}x${rect.height}` + | |
| `+${Math.ceil(rect.left) + window.screenX}` + | |
| `+${rect.top + window.screenY + window.outerHeight - window.innerHeight + 10}`; | |
| console.log(`ytvideo://${document.URL}|--geometry=${geometry}`); | |
| window.open(`ytvideo://${document.URL}|--geometry=${geometry}`).close(); | |
| } | |
| }, true); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Desktop Entry] | |
| Version=1.0 | |
| Name=MPV YouTube | |
| Exec=/usr/bin/ytvideo.sh %U | |
| Terminal=false | |
| Type=Application | |
| MimeType=x-scheme-handler/ytvideo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| IFS=\| read url options <<< "${1//%20/ }" | |
| /usr/bin/mpv ${options} "${url#ytvideo://}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment