您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Replace youtube redirect links with direct links
当前为
- // ==UserScript==
- // @name Replace youtube redirect links
- // @description Replace youtube redirect links with direct links
- // @author MK
- // @namespace max44
- // @homepage https://greasyfork.org/en/users/309172-max44
- // @match *://*.youtube.com/*
- // @match *://*.youtu.be/*
- // @icon https://cdn.icon-icons.com/icons2/1488/PNG/512/5295-youtube-i_102568.png
- // @version 1.1
- // @license MIT
- // @require https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
- // @run-at document-idle
- // ==/UserScript==
- (function() {
- 'use strict';
- document.querySelectorAll("a[href*='/redirect?']").forEach(replaceRedirect);
- $( window ).scroll(function() {
- document.querySelectorAll("a[href*='/redirect?']").forEach(replaceRedirect);
- });
- function replaceRedirect(link) {
- link.href = decodeURIComponent(link.href.replace (/^.*\?(.*&)q=([^&]+)(&.*)?$/, '$2'));
- const wrpLink = link.wrappedJSObject || link;
- if (wrpLink.data && wrpLink.data.urlEndpoint)
- wrpLink.data.urlEndpoint.url = link.href;
- }
- })();