您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Youku 视频去广
// ==UserScript== // @name Youku 视频去广告 // @namespace Youku.com // @version 0.1 // @description Youku 视频去广 // @match https://v.youku.com/v_show/* // @run-at document-start // @grant none // ==/UserScript== (() => { 'use strict'; const rules = [ { //去倒计时 url: /^(https:)?\/\/acs\.youku\.com\/h5\/mtop\.youku\.play\.ups\.appinfo\.get.+callback=mtopjsonp.+/, async callback (url) { const val = await (await fetch(url, { credentials: 'include' })).text(); const cb = url.match(/mtopjsonp\d*/); if(!cb) return; const index = val.indexOf(cb[0]); if(index < 2){ const json = JSON.parse(val.slice(index + cb[0].length + 1, -1)); delete json.data.data.ad; createScript(`${cb[0]}(${JSON.stringify(json)})`); } } } ]; const createScript = (text) => { const script = document.createElement('script'); script.textContent = text; document.head.appendChild(script); script.remove(); } Object.defineProperty( HTMLScriptElement.prototype, '_original', Object.getOwnPropertyDescriptor(HTMLScriptElement.prototype, 'src') ); Object.defineProperty(HTMLScriptElement.prototype, 'src', { get () { return this._original; }, set (val) { const rule = rules.find(r => r.url.test(val)); if (rule) { rule.callback(val); }else{ this._original = val; } } }); })();