Remove YouTube Share Identifier

Remove the "si" parameter from YouTube share links.

当前为 2025-04-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Remove YouTube Share Identifier
  3. // @name:vi Xóa Định Danh Chia Sẻ YouTube
  4. // @namespace https://greasyfork.org/en/users/1240674-anhkhoakz
  5. // @version 1.0.1
  6. // @match *://*.youtube.com/watch*
  7. // @license GPLv3; https://www.gnu.org/licenses/gpl-3.0.html#license-text
  8. // @icon https://i.imgur.com/f1OgZDI.png
  9. // @grant none
  10. // @description Remove the "si" parameter from YouTube share links.
  11. // @description:vi Xóa tham số "SI" khỏi các liên kết chia sẻ YouTube.
  12. // @author anhkhoakz; https://www.anhkhoakz.dev/
  13. // ==/UserScript==
  14.  
  15. (()=>{"use strict";const e=new MutationObserver(e=>{const s=e.filter(e=>e.addedNodes[0]&&e.addedNodes[0].tagName==="YT-COPY-LINK-RENDERER").map(e=>e.addedNodes[0]);if(!s.length)return;const t=s[0].querySelector("input#share-url");if(!t)return;const n=t.value.split(/[?&]/).filter(e=>!e.includes("si="));t.value=n.length>1?`${n[0]}?${n.slice(1).join("&")}`:n[0];let o=t.value;const i=()=>{if(!t)return;if(t.value===o)return;const e=t.value.split(/[?&]/).filter(e=>!e.includes("si="));t.value=e.length>1?`${e[0]}?${e.slice(1).join("&")}`:e[0],o=t.value,window.requestAnimationFrame(i)};window.requestAnimationFrame(i)});e.observe(document.documentElement,{childList:!0,subtree:!0})})()