Last active
November 1, 2024 12:27
-
-
Save Fang-/7db1ac4e798a7128f006fa535f42cfb0 to your computer and use it in GitHub Desktop.
Turn Youtube links into IINA application links.
This file contains 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 Open Youtube links in IINA | |
// @namespace https://palfun-foslup.urbit.org/ | |
// @description Replaces Youtube links with a link to open them in IINA. Set a useful whitelist for yourself. | |
// @include *youtube.com/* | |
// @updateURL https://gist.githubusercontent.com/Fang-/7db1ac4e798a7128f006fa535f42cfb0/raw/25b60b08e55be87d2b0d5630d1f580b15ca2870d/iina-youtube.js | |
// @downloadURL https://gist.githubusercontent.com/Fang-/7db1ac4e798a7128f006fa535f42cfb0/raw/25b60b08e55be87d2b0d5630d1f580b15ca2870d/iina-youtube.js | |
// @run-at document-end | |
// @version 1.0 | |
// ==/UserScript== | |
var ans = document.getElementsByTagName("a"); | |
for (var i = 0; i < ans.length; i++) | |
{ | |
var ref = ans[i].href; | |
if (ref.includes("youtube.com/watch?v=") || ref.includes("youtu.be/")) | |
ans[i].href = "iina://weblink?url=" + ref; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment