// ==UserScript==
// @namespace greasyfork
// @name B站番剧解锁
// @description 解除哔哩哔哩番剧的大会员和港澳台在线观看限制 油管和B站视频下载
// @version 0.1.21
// @match *://*.bilibili.com/*
// @match *://*.biligame.com/*
// @match *://*.youtube.com/*
// @exclude *://message.bilibili.com/*
// @exclude *://passport.bilibili.com/*
// @connect bilibili.com
// @connect 121.5.226.51
// @connect 127.0.0.1
// @grant GM_addStyle
// @grant GM_info
// @grant GM_cookie
// @grant GM_download
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_setClipboard
// @grant GM_xmlhttpRequest
// @run-at document-start
// ==/UserScript==
void function() {
function zset() {
if (u.zdom(), document.querySelector("#zyset")) ipod.aria2 && u.zform("#zyset input", ipod.aria2), document.querySelector("#zyset").setAttribute("style", "display: flex"); else {
let str;
switch (u.zhost()) {
case "baidu.com":
str = '
';
break;
case "youtube.com":
str = '';
break;
default:
str = '';
}
document.body.insertAdjacentHTML("beforeend", str), ipod.aria2 && u.zform("#zyset input", ipod.aria2);
let dom = document.querySelector("span[name=cpua]");
dom && dom.addEventListener("click", () => {
u.zdom(), GM_xmlhttpRequest({
url: "http://121.5.226.51/baiduyun/ua.txt",
method: "GET",
responseType: "text",
onload(r) {
console.log("ua = %s", r.response), GM_setClipboard(r.response, "text");
}
});
}), document.querySelector("#zyset").setAttribute("style", "display:flex"), document.querySelector("#zyset button[type=button]").addEventListener("click", () => {
u.zdom(), document.querySelector("#zyset").removeAttribute("style");
}), document.querySelector("#zyset form").addEventListener("submit", () => {
let dom = u.zdom(), d = new FormData(dom);
ipod.aria2 = Object.assign({}, ipod.defaults, Object.fromEntries(d.entries())), u.save("aria2", ipod.aria2), document.querySelector("#zyset").setAttribute("style", "display:none");
});
}
}
function zproxy() {
let xhr2 = unsafeWindow.XMLHttpRequest, ajax2 = (url, cookie = 0) => {
let xhr = new xhr2();
return xhr.open("GET", url, false), xhr.withCredentials = cookie, xhr.send(), xhr.responseText;
};
unsafeWindow.XMLHttpRequest = new Proxy(XMLHttpRequest, {
construct(target) {
let pod = {};
return new Proxy(new target(), {
set: (target, prop, value) => (target[prop] = value, true),
get(target, prop) {
if (pod.hasOwnProperty(prop)) return pod[prop];
let value = target[prop];
if ("function" == typeof value) {
let bc = value;
value = function() {
if ("open" == prop) pod.method = arguments[0], pod.url = arguments[1]; else if ("send" == prop) if (pod.url.includes("/info?mid=11783021&")) pod.responseText = '{"code":0,"message":"0","ttl":1,"data":{"mid":11783021,"name":"\u54d4\u54e9\u54d4\u54e9\u756a\u5267\u51fa\u5dee","sex":"\u4fdd\u5bc6","face":"http://i2.hdslb.com/bfs/face/9f10323503739e676857f06f5e4f5eb323e9f3f2.jpg","sign":"","rank":10000,"level":6,"jointime":0,"moral":0,"silence":0,"birthday":"","coins":0,"fans_badge":false,"fans_medal":{"show":false,"wear":false,"medal":null},"official":{"role":3,"title":"\u54d4\u54e9\u54d4\u54e9\u756a\u5267\u51fa\u5dee \u5b98\u65b9\u8d26\u53f7","desc":"","type":1},"vip":{"type":0,"status":0,"due_date":0,"vip_pay_type":0,"theme_type":0,"label":{"path":"","text":"","label_theme":"","text_color":"","bg_style":0,"bg_color":"","border_color":""},"avatar_subscript":0,"nickname_color":"","role":0,"avatar_subscript_url":""},"pendant":{"pid":0,"name":"","image":"","expire":0,"image_enhance":"","image_enhance_frame":""},"nameplate":{"nid":0,"name":"","image":"","image_small":"","level":"","condition":""},"user_honour_info":{"mid":0,"colour":null,"tags":null},"is_followed":false,"top_photo":"http://i1.hdslb.com/bfs/space/cb1c3ef50e22b6096fde67febe863494caefebad.png","theme":{},"sys_notice":{},"live_room":{"roomStatus":0}}}'; else if (pod.url.includes("/game/comment/user/my_comment")) pod.responseText = '{"code":-703,"message":"\u6570\u636e\u4e3a\u7a7a","request_id":"20c36cc00e7a11ec84a2b6c4aae96307","ts":1630867824012}'; else if (pod.url.includes("/pc/game/user/space/comment_list")) pod.responseText = '{"code":0,"message":"\u6210\u529f","request_id":"64b686e00e7c11ec9f779a4ceb236e23","ts":1630868797006,"data":[]}'; else if (pod.url.includes("/pgc/player/web/playurl?")) {
let url = pod.url.startsWith("//") ? location.protocol + pod.url : pod.url, s = ajax2(url, 1), d = JSON.parse(s);
0 == d.code && 0 == d.result.is_preview || ipod.pay ? pod.responseText = s : (s = url.substring(url.indexOf("?") + 1), s = ajax2(url = `${ipod.home}/ajax.php?act=bvlink&${s}&version=${ipod.version}&sign=${ipod.sign}`), 0 == (d = JSON.parse(s)).code && (pod.responseText = 86 == ipod.zone.country_code && u.now() > ipod.dtpub ? s.replace(/\/\/.+?\//g, "//" + ipod.aria2.cdn + "/") : s));
} else if (pod.url.includes("/pgc/view/web/season?")) {
let id = u.strcut(location.pathname, "/play/ep"), url = pod.url.startsWith("//") ? location.protocol + pod.url : pod.url, d = JSON.parse(ajax2(url, 1));
0 == d.code && (ipod.pay = 0, d.result.hasOwnProperty("payment") && (0 == Number.parseFloat(d.result.payment.price) || (ipod.pay = 1)), d.result.episodes.forEach(t => {
t.status = 2, t.rights.area_limit = 0, t.badge = "", t.badge_type = 0, t.id == id && (ipod.dtpub = t.pub_time + 9e4);
})), pod.responseText = JSON.stringify(d);
} else if (pod.url.includes("/pgc/view/web/season/user/status")) {
let url = pod.url.startsWith("//") ? location.protocol + pod.url : pod.url, d = JSON.parse(ajax2(url, 1));
0 == d.code && (d.result.area_limit = 0, d.result.ban_area_show = 0, d.result.vip_info.due_date = ipod.dtvip, d.result.vip_info.status = 1, d.result.vip_info.type = 1), pod.responseText = JSON.stringify(d);
}
return bc.apply(target, arguments);
};
}
return value;
}
});
}
});
}
var ipod = {}, u = {
now: () => Math.ceil(Date.now() / 1e3),
uid: () => Date.now().toString(36).toUpperCase(),
zhost: () => location.hostname.split(".").slice(-2).join("."),
rand: max => Math.floor(1e6 * Math.random()) % max,
urlfix: str => str.startsWith("http") ? str : str.startsWith("//") ? location.protocol + str : str.startsWith("/") ? location.origin + str : location.origin + "/" + str,
usp: str => Object.fromEntries(new URLSearchParams(str).entries()),
unique: arr => arr.fliter((t, i, d) => d.indexOf(t) == i),
cclean: arr => Object.entries(Object.fromEntries(arr.map(t => [t.name, t.value]))).map(t => t.join("=")),
serialize: obj => u.vobj(obj) ? Object.entries(obj).map(t => t[0] + "=" + encodeURIComponent(t[1])).join("&") : "",
vfunc: fn => "[object Function]" == Object.prototype.toString.call(fn),
vnum: num => "[object Number]" == Object.prototype.toString.call(num),
vobj: obj => "[object Object]" == Object.prototype.toString.call(obj),
vstr: str => "[object String]" == Object.prototype.toString.call(str),
xpath: str => document.evaluate(str, document).iterateNext(),
pwd(bit = 4) {
let i, arr = [], str = "abcdefghijklmnopqrstuvwxyz23456789ABCDEFGHKLMNPSTVWXY", len = str.length;
for (i = 0; bit > i; i++) arr.push(str.charAt(u.rand(len)));
return arr.join("");
},
zdom(child = 0) {
let e = window.event;
return e.preventDefault(), e.stopPropagation(), child ? e.target : e.currentTarget;
},
zero(num, bit = 3) {
let s, i = +num;
return (s = isNaN(i) ? "0" : "" + i).padStart(bit, "0");
},
fsize(num, pos = 0) {
let s, t = +num;
if (0 == t) s = ""; else {
let i = 0, arr = ["B", "KB", "MB", "GB", "TB", "PB"];
while (t > 1024) i++, t = Math.ceil(t / 1024);
s = (t = Math.round(num / Math.pow(1024, i))) + arr[i + pos];
}
return s;
},
urlopen(url, w = 1) {
let dom = document.createElement("a");
dom.setAttribute("href", url), 1 == w && dom.setAttribute("target", "_blank"), dom.click();
},
aria2(list) {
let arr = [], pod = {
id: u.uid(),
method: "system.multicall",
params: []
};
list.forEach(t => {
Object.keys(t).forEach(p => {
u.vnum(t[p]) && (t[p] = "" + t[p]);
});
let o = {
methodName: "aria2.addUri",
params: []
};
ipod.aria2.token && o.params.push("token:" + ipod.aria2.token), o.params.push(t.url), t.hasOwnProperty("split") || (t.split = "" + t.url.length), t.hasOwnProperty("extype") && (t.out = pod.id + t.extype), o.params.push(t), arr.push(o);
}), pod.params.push(arr), GM_xmlhttpRequest({
url: ipod.aria2.jsonrpc,
method: "POST",
responseType: "json",
data: JSON.stringify(pod),
onerror() {
alert("\u8bf7\u68c0\u67e5Motrix\u662f\u5426\u8fd0\u884c\u4ee5\u53ca\u8bbe\u7f6e\u91cc\u586b\u5199\u7684jsonrpc\u662f\u5426\u6b63\u786e");
}
});
},
zform(str, obj) {
document.querySelectorAll(str).forEach(t => {
let s = t.getAttribute("name");
if (obj.hasOwnProperty(s)) switch (t.getAttribute("type")) {
case "radio":
obj[s] == t.value && (t.checked = true);
break;
case "checkbox":
obj[s] && (t.checked = true);
break;
default:
t.value = obj[s];
}
});
},
cpdom(node) {
let dom = null;
return node instanceof HTMLElement && (dom = node.cloneNode(true), node.after(dom), node.remove()), dom;
},
load(name, val) {
name += "." + u.zhost();
let s = GM_getValue(name);
return s ? JSON.parse(s) : val;
},
save(name, data) {
name += "." + u.zhost(), GM_setValue(name, JSON.stringify(data));
},
strcut(str, x, y) {
let a, b, s = "";
return str && x && str.includes(x) && (a = str.indexOf(x) + x.length, y ? -1 == (b = str.indexOf(y, a)) && (b = str.length) : b = str.length, s = str.substring(a, b)), s;
},
str2obj(str) {
let o = null;
return u.vstr(str) && str.length && (o = str.includes('"') ? JSON.parse(str) : JSON.parse(str.replaceAll(/'/g, '"'))), o;
},
sprintf(str) {
let i, regx, s = u.vstr(str) ? str : "";
if (s.length) for (i = arguments.length - 1; i > 0; i--) regx = RegExp("%" + i, "g"), s = s.replaceAll(regx, arguments[i]);
return s;
},
download(str) {
if (str) {
let o = str.startsWith("magnet:") ? {
url: []
} : {
url: [],
"use-header": "true",
"min-split-size": "1M",
split: "8"
};
Object.assign(o, ipod.aria2), str = str.startsWith("magnet:") ? u.magnet(str) : str.startsWith("http") ? str : str.startsWith("//") ? location.protocol + str : str.startsWith("/") ? location.origin + str : location.origin + "/" + str, o.url.push(str), u.aria2([o]);
}
},
magnet(str) {
let i = str.indexOf("&");
return -1 == i ? str : str.substring(0, i);
},
namefix(str) {
let i, arr = ['"', "'", "*", ":", "<", ">", "?", "|"];
for (i = 0; arr.length > i; i++) str = str.replaceAll(arr[i], "");
return str.replaceAll("\\", "/").replaceAll("//", "/");
},
tpl(str, data) {
const jstpl = (html, obj) => html.replaceAll(/\[(\w{1,16})\]/g, (mat, k) => obj.hasOwnProperty(k) ? obj[k] : "[" + k + "]");
return (Array.isArray(data) ? data : [data]).map(t => jstpl(str, t)).join("");
},
history(str) {
const origin = history[str];
return function() {
let e = new Event(str);
return e.arguments = arguments, window.dispatchEvent(e), origin.apply(this, arguments);
};
},
jsload(url, name) {
let dom = document.createElement("script");
dom.src = u.urlfix(url), name && dom.setAttribute("name", name), dom.setAttribute("async", "true"), dom.setAttribute("crossorigin", "anonymous"), document.head.appendChild(dom);
},
usp(str) {
let arr = (str.startsWith("?") ? str.substring(1) : str).split("&").map(t => t.split("="));
return Object.fromEntries(arr);
},
swClassName(str) {
if (str && u.vstr(str)) {
let arr = Array.from(ipod.checkbox.classList);
arr.includes(str) ? arr = arr.filter(t => t != str) : arr.push("on"), ipod.checkbox.className = arr.join(" ");
}
}
};
if (ipod.version = GM_info.script.version, ipod.cookie = "", ipod.idle = 1, ipod.now = u.now(), GM_addStyle(String.raw`@font-face{font-family:"Ionicons";src:url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.eot?v=4.5.5#iefix") format("embedded-opentype"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.woff2?v=4.5.5") format("woff2"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.woff?v=4.5.5") format("woff"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.ttf?v=4.5.5") format("truetype"),url("https://cdn.bootcss.com/ionicons/4.5.6/fonts/ionicons.svg?v=4.5.5#Ionicons") format("svg");font-weight:normal;font-style:normal}i[class|=ion]{display:inline-block;font-family:"Ionicons";font-size:120%;font-style:normal;font-variant:normal;font-weight:normal;line-height:1;text-rendering:auto;text-transform:none;vertical-align:text-bottom;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.ion-android:before{content:"\f225"}.ion-angular:before{content:"\f227"}.ion-apple:before{content:"\f229"}.ion-bitbucket:before{content:"\f193"}.ion-bitcoin:before{content:"\f22b"}.ion-buffer:before{content:"\f22d"}.ion-chrome:before{content:"\f22f"}.ion-closed-captioning:before{content:"\f105"}.ion-codepen:before{content:"\f230"}.ion-css3:before{content:"\f231"}.ion-designernews:before{content:"\f232"}.ion-dribbble:before{content:"\f233"}.ion-dropbox:before{content:"\f234"}.ion-euro:before{content:"\f235"}.ion-facebook:before{content:"\f236"}.ion-flickr:before{content:"\f107"}.ion-foursquare:before{content:"\f237"}.ion-freebsd-devil:before{content:"\f238"}.ion-game-controller-a:before{content:"\f13b"}.ion-game-controller-b:before{content:"\f181"}.ion-github:before{content:"\f239"}.ion-google:before{content:"\f23a"}.ion-googleplus:before{content:"\f23b"}.ion-hackernews:before{content:"\f23c"}.ion-html5:before{content:"\f23d"}.ion-instagram:before{content:"\f23e"}.ion-ionic:before{content:"\f150"}.ion-ionitron:before{content:"\f151"}.ion-javascript:before{content:"\f23f"}.ion-linkedin:before{content:"\f240"}.ion-markdown:before{content:"\f241"}.ion-model-s:before{content:"\f153"}.ion-no-smoking:before{content:"\f109"}.ion-nodejs:before{content:"\f242"}.ion-npm:before{content:"\f195"}.ion-octocat:before{content:"\f243"}.ion-pinterest:before{content:"\f244"}.ion-playstation:before{content:"\f245"}.ion-polymer:before{content:"\f15e"}.ion-python:before{content:"\f246"}.ion-reddit:before{content:"\f247"}.ion-rss:before{content:"\f248"}.ion-sass:before{content:"\f249"}.ion-skype:before{content:"\f24a"}.ion-slack:before{content:"\f10b"}.ion-snapchat:before{content:"\f24b"}.ion-steam:before{content:"\f24c"}.ion-tumblr:before{content:"\f24d"}.ion-tux:before{content:"\f2ae"}.ion-twitch:before{content:"\f2af"}.ion-twitter:before{content:"\f2b0"}.ion-usd:before{content:"\f2b1"}.ion-vimeo:before{content:"\f2c4"}.ion-vk:before{content:"\f10d"}.ion-whatsapp:before{content:"\f2c5"}.ion-windows:before{content:"\f32f"}.ion-wordpress:before{content:"\f330"}.ion-xbox:before{content:"\f34c"}.ion-xing:before{content:"\f10f"}.ion-yahoo:before{content:"\f34d"}.ion-yen:before{content:"\f34e"}.ion-youtube:before{content:"\f34f"}.ion-add:before{content:"\f273"}.ion-add-circle:before{content:"\f272"}.ion-add-circle-outline:before{content:"\f158"}.ion-airplane:before{content:"\f15a"}.ion-alarm:before{content:"\f274"}.ion-albums:before{content:"\f275"}.ion-alert:before{content:"\f276"}.ion-american-football:before{content:"\f277"}.ion-analytics:before{content:"\f278"}.ion-aperture:before{content:"\f279"}.ion-apps:before{content:"\f27a"}.ion-appstore:before{content:"\f27b"}.ion-archive:before{content:"\f27c"}.ion-arrow-back:before{content:"\f27d"}.ion-arrow-down:before{content:"\f27e"}.ion-arrow-dropdown:before{content:"\f280"}.ion-arrow-dropdown-circle:before{content:"\f27f"}.ion-arrow-dropleft:before{content:"\f282"}.ion-arrow-dropleft-circle:before{content:"\f281"}.ion-arrow-dropright:before{content:"\f284"}.ion-arrow-dropright-circle:before{content:"\f283"}.ion-arrow-dropup:before{content:"\f286"}.ion-arrow-dropup-circle:before{content:"\f285"}.ion-arrow-forward:before{content:"\f287"}.ion-arrow-round-back:before{content:"\f288"}.ion-arrow-round-down:before{content:"\f289"}.ion-arrow-round-forward:before{content:"\f28a"}.ion-arrow-round-up:before{content:"\f28b"}.ion-arrow-up:before{content:"\f28c"}.ion-at:before{content:"\f28d"}.ion-attach:before{content:"\f28e"}.ion-backspace:before{content:"\f28f"}.ion-barcode:before{content:"\f290"}.ion-baseball:before{content:"\f291"}.ion-basket:before{content:"\f292"}.ion-basketball:before{content:"\f293"}.ion-battery-charging:before{content:"\f294"}.ion-battery-dead:before{content:"\f295"}.ion-battery-full:before{content:"\f296"}.ion-beaker:before{content:"\f297"}.ion-bed:before{content:"\f160"}.ion-beer:before{content:"\f298"}.ion-bicycle:before{content:"\f299"}.ion-bluetooth:before{content:"\f29a"}.ion-boat:before{content:"\f29b"}.ion-body:before{content:"\f29c"}.ion-bonfire:before{content:"\f29d"}.ion-book:before{content:"\f29e"}.ion-bookmark:before{content:"\f29f"}.ion-bookmarks:before{content:"\f2a0"}.ion-bowtie:before{content:"\f2a1"}.ion-briefcase:before{content:"\f2a2"}.ion-browsers:before{content:"\f2a3"}.ion-brush:before{content:"\f2a4"}.ion-bug:before{content:"\f2a5"}.ion-build:before{content:"\f2a6"}.ion-bulb:before{content:"\f2a7"}.ion-bus:before{content:"\f2a8"}.ion-business:before{content:"\f1a4"}.ion-cafe:before{content:"\f2a9"}.ion-calculator:before{content:"\f2aa"}.ion-calendar:before{content:"\f2ab"}.ion-call:before{content:"\f2ac"}.ion-camera:before{content:"\f2ad"}.ion-car:before{content:"\f2b2"}.ion-card:before{content:"\f2b3"}.ion-cart:before{content:"\f2b4"}.ion-cash:before{content:"\f2b5"}.ion-cellular:before{content:"\f164"}.ion-chatboxes:before{content:"\f2b6"}.ion-chatbubbles:before{content:"\f2b7"}.ion-checkbox:before{content:"\f2b9"}.ion-checkbox-outline:before{content:"\f2b8"}.ion-checkmark:before{content:"\f2bc"}.ion-checkmark-circle:before{content:"\f2bb"}.ion-checkmark-circle-outline:before{content:"\f2ba"}.ion-clipboard:before{content:"\f2bd"}.ion-clock:before{content:"\f2be"}.ion-close:before{content:"\f2c0"}.ion-close-circle:before{content:"\f2bf"}.ion-close-circle-outline:before{content:"\f166"}.ion-cloud:before{content:"\f2c9"}.ion-cloud-circle:before{content:"\f2c2"}.ion-cloud-done:before{content:"\f2c3"}.ion-cloud-download:before{content:"\f2c6"}.ion-cloud-outline:before{content:"\f2c7"}.ion-cloud-upload:before{content:"\f2c8"}.ion-cloudy:before{content:"\f2cb"}.ion-cloudy-night:before{content:"\f2ca"}.ion-code:before{content:"\f2ce"}.ion-code-download:before{content:"\f2cc"}.ion-code-working:before{content:"\f2cd"}.ion-cog:before{content:"\f2cf"}.ion-color-fill:before{content:"\f2d0"}.ion-color-filter:before{content:"\f2d1"}.ion-color-palette:before{content:"\f2d2"}.ion-color-wand:before{content:"\f2d3"}.ion-compass:before{content:"\f2d4"}.ion-construct:before{content:"\f2d5"}.ion-contact:before{content:"\f2d6"}.ion-contacts:before{content:"\f2d7"}.ion-contract:before{content:"\f2d8"}.ion-contrast:before{content:"\f2d9"}.ion-copy:before{content:"\f2da"}.ion-create:before{content:"\f2db"}.ion-crop:before{content:"\f2dc"}.ion-cube:before{content:"\f2dd"}.ion-cut:before{content:"\f2de"}.ion-desktop:before{content:"\f2df"}.ion-disc:before{content:"\f2e0"}.ion-document:before{content:"\f2e1"}.ion-done-all:before{content:"\f2e2"}.ion-download:before{content:"\f2e3"}.ion-easel:before{content:"\f2e4"}.ion-egg:before{content:"\f2e5"}.ion-exit:before{content:"\f2e6"}.ion-expand:before{content:"\f2e7"}.ion-eye:before{content:"\f2e9"}.ion-eye-off:before{content:"\f2e8"}.ion-fastforward:before{content:"\f2ea"}.ion-female:before{content:"\f2eb"}.ion-filing:before{content:"\f2ec"}.ion-film:before{content:"\f2ed"}.ion-finger-print:before{content:"\f2ee"}.ion-fitness:before{content:"\f1ac"}.ion-flag:before{content:"\f2ef"}.ion-flame:before{content:"\f2f0"}.ion-flash:before{content:"\f17e"}.ion-flash-off:before{content:"\f12f"}.ion-flashlight:before{content:"\f16b"}.ion-flask:before{content:"\f2f2"}.ion-flower:before{content:"\f2f3"}.ion-folder:before{content:"\f2f5"}.ion-folder-open:before{content:"\f2f4"}.ion-football:before{content:"\f2f6"}.ion-funnel:before{content:"\f2f7"}.ion-gift:before{content:"\f199"}.ion-git-branch:before{content:"\f2fa"}.ion-git-commit:before{content:"\f2fb"}.ion-git-compare:before{content:"\f2fc"}.ion-git-merge:before{content:"\f2fd"}.ion-git-network:before{content:"\f2fe"}.ion-git-pull-request:before{content:"\f2ff"}.ion-glasses:before{content:"\f300"}.ion-globe:before{content:"\f301"}.ion-grid:before{content:"\f302"}.ion-hammer:before{content:"\f303"}.ion-hand:before{content:"\f304"}.ion-happy:before{content:"\f305"}.ion-headset:before{content:"\f306"}.ion-heart:before{content:"\f308"}.ion-heart-dislike:before{content:"\f167"}.ion-heart-empty:before{content:"\f1a1"}.ion-heart-half:before{content:"\f1a2"}.ion-help:before{content:"\f30b"}.ion-help-buoy:before{content:"\f309"}.ion-help-circle:before{content:"\f30a"}.ion-help-circle-outline:before{content:"\f16d"}.ion-home:before{content:"\f30c"}.ion-hourglass:before{content:"\f111"}.ion-ice-cream:before{content:"\f30d"}.ion-image:before{content:"\f30e"}.ion-images:before{content:"\f30f"}.ion-infinite:before{content:"\f310"}.ion-information:before{content:"\f312"}.ion-information-circle:before{content:"\f311"}.ion-information-circle-outline:before{content:"\f16f"}.ion-jet:before{content:"\f315"}.ion-journal:before{content:"\f18d"}.ion-key:before{content:"\f316"}.ion-keypad:before{content:"\f317"}.ion-laptop:before{content:"\f318"}.ion-leaf:before{content:"\f319"}.ion-link:before{content:"\f22e"}.ion-list:before{content:"\f31b"}.ion-list-box:before{content:"\f31a"}.ion-locate:before{content:"\f31c"}.ion-lock:before{content:"\f31d"}.ion-log-in:before{content:"\f31e"}.ion-log-out:before{content:"\f31f"}.ion-magnet:before{content:"\f320"}.ion-mail:before{content:"\f322"}.ion-mail-open:before{content:"\f321"}.ion-mail-unread:before{content:"\f172"}.ion-male:before{content:"\f323"}.ion-man:before{content:"\f324"}.ion-map:before{content:"\f325"}.ion-medal:before{content:"\f326"}.ion-medical:before{content:"\f327"}.ion-medkit:before{content:"\f328"}.ion-megaphone:before{content:"\f329"}.ion-menu:before{content:"\f32a"}.ion-mic:before{content:"\f32c"}.ion-mic-off:before{content:"\f32b"}.ion-microphone:before{content:"\f32d"}.ion-moon:before{content:"\f32e"}.ion-more:before{content:"\f1c9"}.ion-move:before{content:"\f331"}.ion-musical-note:before{content:"\f332"}.ion-musical-notes:before{content:"\f333"}.ion-navigate:before{content:"\f334"}.ion-notifications:before{content:"\f338"}.ion-notifications-off:before{content:"\f336"}.ion-notifications-outline:before{content:"\f337"}.ion-nuclear:before{content:"\f339"}.ion-nutrition:before{content:"\f33a"}.ion-open:before{content:"\f33b"}.ion-options:before{content:"\f33c"}.ion-outlet:before{content:"\f33d"}.ion-paper:before{content:"\f33f"}.ion-paper-plane:before{content:"\f33e"}.ion-partly-sunny:before{content:"\f340"}.ion-pause:before{content:"\f341"}.ion-paw:before{content:"\f342"}.ion-people:before{content:"\f343"}.ion-person:before{content:"\f345"}.ion-person-add:before{content:"\f344"}.ion-phone-landscape:before{content:"\f346"}.ion-phone-portrait:before{content:"\f347"}.ion-photos:before{content:"\f348"}.ion-pie:before{content:"\f349"}.ion-pin:before{content:"\f34a"}.ion-pint:before{content:"\f34b"}.ion-pizza:before{content:"\f354"}.ion-planet:before{content:"\f356"}.ion-play:before{content:"\f357"}.ion-play-circle:before{content:"\f174"}.ion-podium:before{content:"\f358"}.ion-power:before{content:"\f359"}.ion-pricetag:before{content:"\f35a"}.ion-pricetags:before{content:"\f35b"}.ion-print:before{content:"\f35c"}.ion-pulse:before{content:"\f35d"}.ion-qr-scanner:before{content:"\f35e"}.ion-quote:before{content:"\f35f"}.ion-radio:before{content:"\f362"}.ion-radio-button-off:before{content:"\f360"}.ion-radio-button-on:before{content:"\f361"}.ion-rainy:before{content:"\f363"}.ion-recording:before{content:"\f364"}.ion-redo:before{content:"\f365"}.ion-refresh:before{content:"\f366"}.ion-refresh-circle:before{content:"\f228"}.ion-remove:before{content:"\f368"}.ion-remove-circle:before{content:"\f367"}.ion-remove-circle-outline:before{content:"\f176"}.ion-reorder:before{content:"\f369"}.ion-repeat:before{content:"\f36a"}.ion-resize:before{content:"\f36b"}.ion-restaurant:before{content:"\f36c"}.ion-return-left:before{content:"\f36d"}.ion-return-right:before{content:"\f36e"}.ion-reverse-camera:before{content:"\f36f"}.ion-rewind:before{content:"\f370"}.ion-ribbon:before{content:"\f371"}.ion-rocket:before{content:"\f179"}.ion-rose:before{content:"\f372"}.ion-sad:before{content:"\f373"}.ion-save:before{content:"\f1a9"}.ion-school:before{content:"\f374"}.ion-search:before{content:"\f375"}.ion-send:before{content:"\f376"}.ion-settings:before{content:"\f377"}.ion-share:before{content:"\f379"}.ion-share-alt:before{content:"\f378"}.ion-shirt:before{content:"\f37a"}.ion-shuffle:before{content:"\f37b"}.ion-skip-backward:before{content:"\f37c"}.ion-skip-forward:before{content:"\f37d"}.ion-snow:before{content:"\f37e"}.ion-speedometer:before{content:"\f37f"}.ion-square:before{content:"\f381"}.ion-square-outline:before{content:"\f380"}.ion-star:before{content:"\f384"}.ion-star-half:before{content:"\f382"}.ion-star-outline:before{content:"\f383"}.ion-stats:before{content:"\f385"}.ion-stopwatch:before{content:"\f386"}.ion-subway:before{content:"\f387"}.ion-sunny:before{content:"\f388"}.ion-swap:before{content:"\f389"}.ion-switch:before{content:"\f38a"}.ion-sync:before{content:"\f38b"}.ion-tablet-landscape:before{content:"\f38c"}.ion-tablet-portrait:before{content:"\f38d"}.ion-tennisball:before{content:"\f38e"}.ion-text:before{content:"\f38f"}.ion-thermometer:before{content:"\f390"}.ion-thumbs-down:before{content:"\f391"}.ion-thumbs-up:before{content:"\f392"}.ion-thunderstorm:before{content:"\f393"}.ion-time:before{content:"\f394"}.ion-timer:before{content:"\f395"}.ion-today:before{content:"\f17d"}.ion-train:before{content:"\f396"}.ion-transgender:before{content:"\f397"}.ion-trash:before{content:"\f398"}.ion-trending-down:before{content:"\f399"}.ion-trending-up:before{content:"\f39a"}.ion-trophy:before{content:"\f39b"}.ion-tv:before{content:"\f17f"}.ion-umbrella:before{content:"\f39c"}.ion-undo:before{content:"\f39d"}.ion-unlock:before{content:"\f39e"}.ion-videocam:before{content:"\f39f"}.ion-volume-high:before{content:"\f123"}.ion-volume-low:before{content:"\f131"}.ion-volume-mute:before{content:"\f3a1"}.ion-volume-off:before{content:"\f3a2"}.ion-walk:before{content:"\f3a4"}.ion-wallet:before{content:"\f18f"}.ion-warning:before{content:"\f3a5"}.ion-watch:before{content:"\f3a6"}.ion-water:before{content:"\f3a7"}.ion-wifi:before{content:"\f3a8"}.ion-wine:before{content:"\f3a9"}.ion-woman:before{content:"\f3aa"}#zym{position:absolute;top:62px;right:15px;background-color:rgba(255,255,255,0.9);box-sizing:border-box;width:400px;font-size:13px}#zym>div{margin:0 15px 15px 15px}#zym>div:first-child{margin-top:15px}#zym>div[name="path"]>span{cursor:default}#zym>div[name="path"]>span:not(:first-child):before{padding:0 8px;font-family:"Ionicons";content:"\f284";color:#09f}#zym>div[name="full"]{margin:0;padding:0}#zym>div>table{width:100%}#zym>div>table>tbody>tr{border-top:1px solid #bdf}#zym>div>table>tbody>tr:last-child{border-bottom:1px solid #bdf}#zym>div>table>tbody>tr.on{color:#000;background-color:#cbedff}#zym>div>table>tbody>tr.on>td:nth-child(1){color:#09f}#zym>div>table>tbody>tr.on>td:nth-child(1):before{content:"\f2b8"}#zym>div>table>tbody>tr>td{cursor:default;line-height:40px}#zym>div>table>tbody>tr>td:nth-child(1){text-align:left;padding-left:12px;color:#999;font-family:"Ionicons";font-size:120%}#zym>div>table>tbody>tr>td:nth-child(1):before{content:"\f380"}#zym>div>table>tbody>tr>td:nth-child(2){overflow:hidden;white-space:nowrap;text-overflow:"";word-wrap:normal;max-width:292px}#zym>div>table>tbody>tr>td:nth-child(2)>input{background-color:transparent;border:none;outline:none;width:100%}#zym>div>table>tbody>tr>td:nth-child(3){text-align:right;padding-right:12px}div.tamper{align-items:center;background-color:rgba(0,0,0,0.7);box-sizing:border-box;cursor:default;display:none;font-size:14px !important;height:100%;justify-content:center;left:0;position:fixed;top:0;text-align:left;width:100%;z-index:999999}div.tamper>div{background-color:white;box-sizing:border-box;padding:1em;width:360px}div.tamper>div.w2{padding:0;width:720px}div.tamper>div.w2>div{padding:10px 20px}div.tamper>div.w2>ul{margin:0;padding:0;display:flex;flex-wrap:wrap;justify-content:center;list-style-type:none;list-style-position:inside}div.tamper>div.w2>ul[id="vlist"]{height:460px;scrollbar-width:none}div.tamper>div.w2>ul[id="vlist"]::-webkit-scrollbar{display:none}div.tamper>div.w2>ul[id="vlist"]>li{width:160px;margin:0px;padding:0px 8px 16px 8px}div.tamper>div.w2>ul[id="vlist"]>li img.pic{display:block;width:160px;height:100px;margin-bottom:5px}div.tamper>div.w2>ul[id="vlist"]>li div.title{white-space:normal;line-height:1.25;display:-webkit-box;overflow:hidden;-webkit-line-clamp:2;-webkit-box-orient:vertical}div.tamper a{color:#333 !important;text-decoration:none}div.tamper h1{font-size:1.8rem;font-weight:400;margin:10px 0 20px 0;text-align:center}div.tamper form{display:block}div.tamper form>div{padding:0.5em 0}div.tamper form>div>div{margin:0.5em 0}div.tamper form>div>div:last-child{margin-bottom:0}div.tamper form label{color:#000}div.tamper form label:first-child{display:block;margin-bottom:0.5em}div.tamper form label:first-child:before{content:"\00bb";margin:0 0.25em}div.tamper form label:not(:first-child){display:inline}div.tamper form input{box-shadow:none;color:#000}div.tamper form input[type="text"]{background-color:#fff;border:1px solid #ddd;box-sizing:border-box;display:block;font-size:1em;padding:0.5em;width:100%}div.tamper form input[type="text"]:focus{border:1px solid #59c1f0}div.tamper form input[type="password"]{background-color:#fff;border:1px solid #ddd;box-sizing:border-box;display:block;font-size:1em;padding:0.5em;width:100%}div.tamper form input[type="password"]:focus{border:1px solid #59c1f0}div.tamper form input[type="radio"],div.tamper form input[type="checkbox"]{display:inline-block !important;height:1em;margin-right:0.25em;width:1em}div.tamper form input[type="checkbox"]{-webkit-appearance:checkbox !important}div.tamper form input[type="radio"]{-webkit-appearance:radio !important}div.tamper ul{margin:0;padding:0;list-style-type:none;list-style-position:inside;max-height:500px;overflow-y:auto;scrollbar-width:none}div.tamper ul>li{box-sizing:content-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0.25em 0;cursor:default}div.tamper ul>li.on{color:#f45a8d}div.summary{color:#666}div.btn-group{box-sizing:border-box;display:inline-flex}div.btn-group.full{display:flex}div.btn-group.outline>button{background-color:#fff;border:1px solid #ccc;color:#000}div.btn-group.outline>button:hover{color:#ffffff;background-color:#000;border-color:#000}div.btn-group.outline>button:not(:first-child){border-left:none}div.btn-group>button{background-color:#666;border-radius:0;border:none;color:#fff;display:inline-block;flex:1 1 auto;margin:0;outline:none;padding:0.5em 1.25em;position:relative;font-size:inherit}div.btn-group>button:hover{background-color:#000}div.btn-group>button:first-child{border-bottom-left-radius:0.25rem;border-top-left-radius:0.25rem}div.btn-group>button:last-child{border-bottom-right-radius:0.25rem;border-top-right-radius:0.25rem}.mt1{margin-top:10px !important}@keyframes spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.spinner{animation-name:spinner;animation-duration:2400ms;animation-timing-function:linear;animation-iteration-count:infinite}`), location.hostname.includes("bilibili.com")) {
function dp(name, opts) {
let tmp;
Object.defineProperty(unsafeWindow, name, {
configurable: true,
enumerable: true,
get: () => tmp,
set(value) {
tmp = opts.zwrite(value);
}
});
}
function dvideo(arr) {
arr.forEach(t => {
GM_xmlhttpRequest({
url: `${ipod.home}/ajax.php?act=bvlink2&bvid=${t.bvid}&cid=${t.cid}&sign=${ipod.sign}`,
method: "GET",
responseType: "json",
onload(r) {
ipod.idx++, 0 == r.response.code && ipod.list.push({
"use-header": "true",
header: ipod.header,
split: "16",
dir: ipod.aria2.dir,
out: t.out,
url: [r.response.data.durl[0].url]
}), ipod.idx == ipod.len && (ipod.idle = 1, document.querySelector("#zydl > i").removeAttribute("style"), u.aria2(ipod.list));
}
});
});
}
function bvlist(str) {
let dom = document.querySelector("#zylist");
dom ? (dom.querySelector("div > ul").innerHTML = str, dom.setAttribute("style", "display: flex")) : (document.body.insertAdjacentHTML("beforeend", ` `), document.querySelector("#zylist > div > ul").addEventListener("click", () => {
let dom = u.zdom(1);
dom.className = "on" == dom.className ? "" : "on";
}), document.querySelector("#zylist > div > div.btn-group").addEventListener("click", () => {
switch (u.zdom(1).getAttribute("name")) {
case "cancel":
document.querySelector("#zylist").setAttribute("style", "display: none"), document.querySelector("#zydl > i").removeAttribute("style");
break;
case "all":
document.querySelectorAll("#zylist > div > ul > li").forEach(t => {
t.className = "on";
});
break;
case "invert":
document.querySelectorAll("#zylist > div > ul > li").forEach(t => {
t.className = "on" == t.className ? "" : "on";
});
break;
default:
let arr = [], list = [];
document.querySelector("#zylist").setAttribute("style", "display: none"), document.querySelectorAll("#zylist > div > ul > li").forEach(t => {
"on" == t.className && arr.push(Number.parseInt(t.getAttribute("name")));
}), ipod.len = arr.length, "video" == ipod.vt && (ipod.vi.videoData.pages.forEach(t => {
arr.includes(t.cid) && list.push({
bvid: ipod.bvid,
cid: t.cid,
out: ipod.bvid + "/" + u.namefix(t.part.replaceAll("/", " ").replaceAll(/\s+/g, " ")) + ".flv"
});
}), dvideo(list)), "anime" == ipod.vt && (ipod.vi.epList.forEach(t => {
arr.includes(t.cid) && list.push({
bvid: t.bvid,
cid: t.cid,
out: ipod.title + "/" + (t.longTitle ? u.zero(t.title, 3) + " " + u.namefix(t.longTitle.replaceAll("/", " ").replaceAll(/\s+/g, " ")) : t.titleFormat) + ".flv"
});
}), dvideo(list));
}
}), document.querySelector("#zylist").setAttribute("style", "display: flex"));
}
function bvdl() {
ipod.idle && (u.zdom(), document.querySelector("#zydl > i").setAttribute("style", "color: #fb7299"), ipod.header = ["User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36", "Referer: " + location.href], ipod.list = [], ipod.idx = 0, ipod.vi = unsafeWindow.__INITIAL_STATE__, ipod.vi.hasOwnProperty("videoData") && (ipod.vt = "video", ipod.bvid = ipod.vi.bvid, ipod.len = ipod.vi.videoData.pages.length, ipod.len > 1 ? bvlist(ipod.vi.videoData.pages.map(t => `${t.part}`).join("")) : dvideo(ipod.vi.videoData.pages.map(t => ({
bvid: ipod.bvid,
cid: t.cid,
out: ipod.bvid + ".flv"
})))), ipod.vi.hasOwnProperty("mediaInfo") && (ipod.vt = "anime", ipod.title = u.namefix(ipod.vi.mediaInfo.title.replaceAll("/", " ").replaceAll(/\s+/g, " ")), ipod.len = ipod.vi.epList.length, ipod.len > 1 ? bvlist(ipod.vi.epList.map(t => {
let s = t.longTitle ? u.zero(t.title, 3) + " " + t.longTitle : t.titleFormat;
return `${s}`;
}).join("")) : dvideo(ipod.vi.epList.map(t => ({
bvid: t.bvid,
cid: t.cid,
out: ipod.title + "/" + u.namefix(t.titleFormat.replaceAll("/", " ").replaceAll(/\s+/g, " ")) + ".flv"
})))));
}
if (ipod.defaults = {
token: "",
jsonrpc: "http://127.0.0.1:16800/jsonrpc",
dir: "D:/HD2A",
cdn: "upos-sz-mirrorks3.bilivideo.com",
coin: 0,
follow: 0
}, ipod.aria2 = u.load("aria2", ipod.defaults), ipod.aria2.hasOwnProperty("cdn") || (ipod.aria2.cdn = "upos-sz-mirrorks3.bilivideo.com", u.save("aria2", ipod.aria2)), ipod.home = "https://121.5.226.51/bz", ipod.dtvip = 1e3 * (ipod.now + 9e4), ipod.dtpub = 0, ipod.latest = u.load("latest", 0), ipod.bzui = u.load("bzui"), ipod.sign = btoa(JSON.stringify(ipod.bzui)), ipod.zone = u.load("zone"), ipod.mid = document.cookie.includes("DedeUserID") ? Number.parseInt(u.strcut(document.cookie, "DedeUserID=", ";")) : 0, ipod.mid) {
if (setTimeout(() => {
document.querySelector("div.logout") && u.cpdom(document.querySelector("div.logout > span")).addEventListener("click", () => {
u.zdom(), GM_cookie.list({}, r => {
r.forEach(t => {
GM_cookie.delete(t);
});
}), location.href = "https://passport.bilibili.com/login";
});
}, 3e3), (null == ipod.bzui || ipod.mid != ipod.bzui.mid || ipod.now > ipod.latest) && (ipod.latest = ipod.now + 9e4, u.save("latest", ipod.latest), GM_cookie.list({}, r => {
let arr = Array.isArray(r) && r.length ? u.cclean(r) : [];
arr.length ? (arr.sort(), ipod.cookie = arr.join(";")) : setTimeout(() => {
console.log("\u67e5\u8be2\u4e0d\u5230\u8d26\u53f7cookie\u4fe1\u606f");
}, 5e3);
}), fetch("https://api.bilibili.com/x/web-interface/nav", {
method: "GET",
mode: "cors",
credentials: "include"
}).then(r => r.json()).then(d => {
ipod.bzui = 0 == d.code ? {
mid: d.data.mid,
level: d.data.level_info.current_level,
vip: d.data.vipStatus,
csrf: u.strcut(document.cookie, "bili_jct=", ";"),
cookie: ipod.cookie
} : null, null == ipod.bzui ? setTimeout(() => {
console.clear(), console.log("\u67e5\u8be2\u4e0d\u5230\u8d26\u53f7\u57fa\u672c\u4fe1\u606f");
}, 2e3) : (ipod.sign = btoa(JSON.stringify(ipod.bzui)), u.save("bzui", ipod.bzui));
}), fetch("https://api.bilibili.com/x/web-interface/zone", {
method: "GET",
mode: "cors",
credentials: "omit"
}).then(r => r.json()).then(d => {
0 == d.code && (ipod.zone = d.data, u.save("zone", ipod.zone));
})), location.pathname.startsWith("/platform/mine") && zproxy(), location.pathname.startsWith("/detail/") && zproxy(), location.pathname.startsWith("/video")) {
let bvid = location.pathname.substring(7, 19);
fetch(`https://api.bilibili.com/x/web-interface/view?bvid=${bvid}`).then(r => r.json()).then(d => {
switch (d.code) {
case -404:
GM_xmlhttpRequest({
url: `${ipod.home}/ajax.php?act=bangumi&version=${ipod.version}&sign=${ipod.sign}&bvid=${bvid}`,
method: "GET",
responseType: "json",
onload(r) {
let d = r.response;
switch (d.code) {
case 0:
location.href = "https://www.bilibili.com/bangumi/play/ep" + d.message;
break;
case 999:
u.urlopen(d.message);
break;
default:
alert(d.message);
}
}
});
break;
default:
ipod.task = setInterval(() => {
document.querySelector("#app").hasAttribute("data-server-rendered") || (clearInterval(ipod.task), ipod.task = 0, ipod.mid && setTimeout(() => {
document.querySelector("#zydl") || (document.querySelector("#arc_toolbar_report > div.ops").insertAdjacentHTML("beforeend", '\u4e0b\u8f7d'), document.querySelector("#zydl").addEventListener("click", bvdl), document.querySelector("#zydl").addEventListener("contextmenu", zset));
}, 3e3));
}, 3e3);
}
});
}
if (location.pathname.startsWith("/bangumi")) {
function initbangumi() {
if ("loading" == document.readyState) dp("__INITIAL_STATE__", {
zwrite: value => (value.mediaInfo && (value.mediaInfo.episodes && value.mediaInfo.episodes.forEach(t => {
t.badge = "", t.badge_type = 0, t.status = 2, t.rights && (t.rights.allow_dm = 1, t.rights.allow_limit = 0);
}), value.mediaInfo.rights && (value.mediaInfo.rights.allowBp = false, value.mediaInfo.rights.allowBpRank = false, value.mediaInfo.rights.appOnly = false, value.mediaInfo.rights.area_limit = 0, value.mediaInfo.rights.canWatch = true), value.mediaInfo.user_status && (value.mediaInfo.user_status.area_limit = 0, value.mediaInfo.user_status.ban_area_show = 0, value.mediaInfo.user_status.sponsor = 0)), value.initEpList && value.initEpList.forEach(t => {
t.badge = "", t.badge_type = 0, t.epStatus = 2, t.status = 2, t.rights && (t.rights.allow_dm = 1, t.rights.allow_limit = 0);
}), value.epList && value.epList.forEach(t => {
t.badge = "", t.badge_type = 0, t.epStatus = 2, t.status = 2, t.rights && (t.rights.allow_dm = 1, t.rights.allow_limit = 0);
}), value.epInfo && (value.epInfo.badge = "", value.epInfo.badge_type = 0, value.epInfo.epStatus = 2, value.epInfo.status = 2, value.epInfo.rights.allow_dm = 1, value.epInfo.rights.area_limit = 0), value)
}); else {
let bvi = unsafeWindow.__INITIAL_STATE__;
u.vobj(bvi) && (bvi.mediaInfo && (bvi.mediaInfo.episodes && bvi.mediaInfo.episodes.forEach(t => {
t.badge = "", t.badge_type = 0, t.status = 2, t.rights && (t.rights.allow_dm = 1, t.rights.allow_limit = 0);
}), bvi.mediaInfo.rights && (bvi.mediaInfo.rights.allowBp = false, bvi.mediaInfo.rights.allowBpRank = false, bvi.mediaInfo.rights.appOnly = false, bvi.mediaInfo.rights.area_limit = 0, bvi.mediaInfo.rights.canWatch = true), bvi.mediaInfo.user_status && (bvi.mediaInfo.user_status.area_limit = 0, bvi.mediaInfo.user_status.ban_area_show = 0, bvi.mediaInfo.user_status.sponsor = 0)), bvi.initEpList && bvi.initEpList.forEach(t => {
t.badge = "", t.badge_type = 0, t.epStatus = 2, t.status = 2, t.rights && (t.rights.allow_dm = 1, t.rights.allow_limit = 0);
}), bvi.epList && bvi.epList.forEach(t => {
t.badge = "", t.badge_type = 0, t.epStatus = 2, t.status = 2, t.rights && (t.rights.allow_dm = 1, t.rights.allow_limit = 0);
}), bvi.epInfo && (bvi.epInfo.badge = "", bvi.epInfo.badge_type = 0, bvi.epInfo.epStatus = 2, bvi.epInfo.status = 2, bvi.epInfo.rights.allow_dm = 1, bvi.epInfo.rights.area_limit = 0));
}
}
history.pushState = u.history("pushState"), unsafeWindow.addEventListener("pushState", initbangumi), history.replaceState = u.history("replaceState"), unsafeWindow.addEventListener("replaceState", initbangumi), document.addEventListener("DOMContentLoaded", () => {
if (null == document.querySelector("#app")) {
let s = u.strcut(location.pathname, "/play/"), id = +s.match(/^(ep|ss)(\d+)/)[2], url = "https://bangumi.bilibili.com/view/web_api/season?" + (s.startsWith("ep") ? "ep_id=" : "season_id=") + id;
fetch(url).then(r => r.json()).then(d => {
if (0 == d.code) {
let ep = s.startsWith("ep") ? d.result.episodes.find(t => t.ep_id == id) : d.result.episodes[0], eplist = JSON.stringify(d.result.episodes.map((t, idx) => (/^\d+(\.\d+)?$/.exec(t.index) ? t.titleFormat = "\u7b2c" + t.index + "\u8bdd " + t.index_title : (t.titleFormat = t.index, t.index_title = t.index), t.loaded = true, t.epStatus = t.episode_status, t.sectionType = 0, t.id = +t.ep_id, t.i = idx, t.link = "https://www.bilibili.com/bangumi/play/ep" + t.ep_id, t.title = t.index, t.rights = {
allow_demand: 0,
allow_dm: 1,
allow_download: 0,
area_limit: 0
}, t.badge = "", t.badge_type = 0, t.badge_info = {
bg_color: "#FB7299",
bg_color_night: "#BB5B76",
text: ""
}, t))), obj = {
id: ep.ep_id,
aid: ep.aid,
cid: ep.cid,
bvid: ep.bvid,
title: ep.index,
titleFormat: titleForma = ep.index_title ? ep.index_title : "\u7b2c" + ep.index + "\u8bdd",
htmlTitle: d.result.title,
mediaInfoId: d.result.media_id,
mediaInfoTitle: d.result.title,
evaluate: d.result.evaluate.replace(/\n/g, "\\\n").replace(/"/g, '\\"').replace(/\r/g, "\\\r").replace(/\t/g, "\\\t").replace(/\b/g, "\\\b").replace(/\f/g, "\\\f"),
cover: d.result.cover,
episodes: eplist,
ssId: d.result.season_id,
appOnly: false
}, doc = String.raw`哔哩哔哩番剧`;
document.open(), document.write(doc.replaceAll(/___(\w+)___/g, (mat, name) => obj[name])), document.close();
}
});
}
ipod.task = setInterval(() => {
if (document.querySelector("#app")) {
clearInterval(ipod.task), setTimeout(() => {
GM_xmlhttpRequest({
url: `${ipod.home}/vlist02.json?t=${ipod.now}`,
method: "GET",
responseType: "json",
nocache: true,
onload(r) {
let d1 = r.response;
Array.isArray(d1) && d1.length && d1.forEach(vi => {
fetch("https://api.bilibili.com/x/web-interface/archive/stat?bvid=" + vi.bvid, {
method: "GET",
mode: "cors",
credentials: "include"
}).then(r => r.json()).then(d2 => {
0 == d2.code && (vi.like = d2.data.like - vi.like1, vi.view = d2.data.view - vi.view1, vi.num > vi.like && (0 == vi.num2 || Math.ceil(100 * vi.num / vi.num2) >= Math.round(100 * vi.like / vi.view)) && fetch("https://api.bilibili.com/x/web-interface/archive/relation?aid=" + vi.aid + "&bvid=" + vi.bvid, {
method: "GET",
mode: "cors",
credentials: "include"
}).then(r => r.json()).then(d3 => {
0 == d3.code && 0 == d3.data.like && fetch("https://api.bilibili.com/x/web-interface/archive/like", {
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
method: "POST",
mode: "cors",
credentials: "include",
body: u.serialize({
aid: vi.aid,
like: 1,
csrf: ipod.bzui.csrf
})
});
}));
});
});
}
});
}, 9e4), document.querySelector("#bvchk") || setTimeout(() => {
let dom = document.querySelector("#toolbar_module");
dom.querySelector("div.watch-info") && dom.querySelector("div.watch-info").remove(), dom.querySelector("div.mobile-info") && dom.querySelector("div.mobile-info").remove(), dom.insertAdjacentHTML("beforeend", '
\u4e0b\u8f7d
'), document.querySelector("#zydl").addEventListener("click", bvdl), document.querySelector("#zydl").addEventListener("contextmenu", zset), document.querySelector("#bvchk").addEventListener("click", () => {
if (ipod.bzui) {
let cid = unsafeWindow.__INITIAL_STATE__.epInfo.cid;
cid && GM_xmlhttpRequest({
url: `${ipod.home}/ajax.php?act=bvfix&cid=${cid}&version=${ipod.version}&sign=${ipod.sign}`,
method: "GET",
responseType: "json",
onload(r) {
let d = r.response;
switch (d.code) {
case 0:
location.reload();
break;
case 999:
u.urlopen(d.message);
break;
default:
alert(d.message);
}
}
});
} else alert("1. \u5982\u679c\u672a\u767b\u5f55\u54d4\u54e9\u54d4\u54e9\u8d26\u53f7\u8bf7\u5148\u767b\u5f55\u5e76\u5237\u65b0\u9875\u9762\n2. \u8bf7\u66f4\u6362\u811a\u672c\u7ba1\u7406\u5668\u4e3aTamperMonkey Beta\uff08\u7ea2\u7334\uff09");
}), document.querySelector("#bvchk").addEventListener("contextmenu", () => {
u.zdom(), document.querySelector("#bvset") ? (u.zform("#bvset input", ipod.aria2), document.querySelector("#bvset").setAttribute("style", "display:flex")) : (document.body.insertAdjacentHTML("beforeend", ''), u.zform("#bvset input", ipod.aria2), document.querySelector("#bvset button[type=button]").addEventListener("click", () => {
u.zdom(), document.querySelector("#bvset").setAttribute("style", "display: none");
}), document.querySelector("#bvset form").addEventListener("submit", () => {
let dom = u.zdom(), d = new FormData(dom);
ipod.aria2 = Object.assign({}, ipod.defaults, Object.fromEntries(d.entries())), u.save("aria2", ipod.aria2), document.querySelector("#bvset").setAttribute("style", "display: none"), GM_xmlhttpRequest({
url: `http://121.5.226.51/bz/ajax.php?act=bzuset?mid=${ipod.mid}&coin=${ipod.aria2.coin}&follow=${ipod.aria2.follow}`,
method: "GET"
});
}), GM_xmlhttpRequest({
url: "http://121.5.226.51/bz/info1.txt",
method: "GET",
responseType: "text",
nocache: true,
onload(r) {
document.querySelector("#info1").innerText = r.response;
}
}));
});
}, 1e3);
let dom = document.querySelector("#seasonlist_module");
if (dom) {
function fixList() {
setTimeout(() => {
dom.querySelectorAll("a").forEach(t => {
let s = t.getAttribute("href");
"/" == s.charAt(s.length - 1) && t.setAttribute("href", s.substring(0, s.length - 1)), u.cpdom(t);
});
}, 1e3);
}
dom.querySelector("div.expand-more") && dom.querySelector("div.expand-more").addEventListener("click", fixList), fixList();
}
}
}, 5e3);
}), initbangumi(), zproxy();
}
if ("space.bilibili.com" == location.hostname) {
function urlplayer() {
let dom = u.zdom(1).closest("a");
if (ipod.idle) if (dom.getAttribute("href").includes("/video/BV")) {
ipod.idle = 0;
let bvid = u.strcut(dom.getAttribute("href"), "/video/");
GM_xmlhttpRequest({
url: `${ipod.home}/ajax.php?act=bangumi&bvid=${bvid}&version=${ipod.version}&sign=${ipod.sign}`,
method: "GET",
responseType: "json",
onload(r) {
ipod.idle = 1;
let d = r.response;
switch (d.code) {
case 0:
location.href = "https://www.bilibili.com/bangumi/play/ep" + d.message;
break;
case 999:
u.urlopen(d.message);
break;
default:
alert(d.message);
}
}
});
} else location.href = dom.getAttribute("href");
}
function vbangumi() {
ipod.task = setInterval(() => {
if (document.querySelector("#app")) {
clearInterval(ipod.task);
let dom = document.querySelector("div.video>div.content");
dom && dom.addEventListener("click", urlplayer), (dom = document.querySelector("#submit-video-list")) && dom.addEventListener("click", urlplayer), (dom = document.querySelector("div.col-1")) && dom.addEventListener("click", urlplayer);
}
}, 1e3);
}
"11783021" == u.strcut(location.pathname, "/", "/") && (history.pushState = u.history("pushState"), unsafeWindow.addEventListener("pushState", vbangumi), history.replaceState = u.history("replaceState"), unsafeWindow.addEventListener("replaceState", vbangumi), vbangumi(), zproxy());
}
} else setTimeout(() => {
console.clear(), console.log("\u9700\u8981\u767b\u5f55\u54d4\u54e9\u54d4\u54e9\u8d26\u53f7");
}, 2e3);
}
if (location.hostname.includes("youtube.com")) {
function ytbdl(data) {
let s, dom, arr = [], ignore = [], id = data.videoDetails.videoId;
data.streamingData.adaptiveFormats.forEach(t => {
t.hasOwnProperty("signatureCipher") && (t.url = t.signatureCipher), t.url && t.mimeType.includes("audio/mp4") && !ignore.includes("audio") && (ignore.push("audio"), arr.push({
name: id + ".mp3",
summary: "\u97f3\u9891",
url: t.url
})), t.url && t.mimeType.includes("video/") && !ignore.includes(s = /p$/.test(t.qualityLabel) ? t.qualityLabel + t.fps : t.qualityLabel) && (ignore.push(s), t.mimeType.includes("video/webm") && Number.parseInt(t.height, 10) > 720 && arr.push({
name: id + ".mp4",
summary: s,
url: t.url
}), t.mimeType.includes("video/mp4") && Number.parseInt(t.height, 10) > 360 && arr.push({
name: id + ".mp4",
summary: s,
url: t.url
}));
}), arr.length ? (arr.reverse(), (dom = document.querySelector("#zydl")) ? (dom.innerHTML = u.tpl(ipod.tpls.dlist, arr), dom.insertAdjacentHTML("afterbegin", '')) : ipod.task = setInterval(() => {
document.querySelector("#meta-contents") && (clearInterval(ipod.task), ipod.task = 0, document.querySelector("#meta-contents").insertAdjacentHTML("beforebegin", ''), (dom = document.querySelector("#zydl")).setAttribute("style", "font-size: 14px; margin-top: .5em"), dom.innerHTML = u.tpl(ipod.tpls.dlist, arr), dom.insertAdjacentHTML("afterbegin", ''), dom.addEventListener("click", async () => {
let node = u.zdom(1);
if (node.hasAttribute("data-url")) {
let url = node.getAttribute("data-url");
if (!url.startsWith("http")) {
u.vfunc(ipod.decsign) || (ipod.decsign = await fetch(document.querySelector('script[src$="base.js"]').src).then(r => r.text()).then(str => {
let arr, name, body;
return arr = /=([\$\w]+?)\(decodeURIComponent/.exec(str), name = (arr = RegExp(arr[1] + "=function\\((.+?)\\){(.+?)}", "s").exec(str))[1], arr = /;(.+?)\..+?\(/.exec(body = arr[2]), arr = RegExp("var " + arr[1] + "={.+?};", "s").exec(str), Function(name, body = arr[0] + "\n" + body);
}));
let o = u.usp(url), sign = ipod.decsign.call(null, o.s);
url = `${o.url}&${o.sp}=${sign}`;
}
ipod.aria2.mode ? (o = {
url,
name: node.getAttribute("data-name"),
saveAs: false
}, GM_download(o)) : (o = {
"all-proxy": ipod.aria2.proxy,
referer: "https://www.youtube.com/",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36",
url: [url],
dir: ipod.aria2.dir,
out: node.getAttribute("data-name"),
split: "16"
}, u.aria2([o]));
} else zset();
}));
}, 1e3)) : (dom = document.querySelector("#zydl")) && (dom.innerHTML = "");
}
unsafeWindow.fetch = new Proxy(fetch, {
apply: (target, obj, args) => target.apply(obj, args).then(r => {
let o = args[0];
return o instanceof Request && o.url.includes("player") && r.clone().json().then(ytbdl), r;
})
}), ipod.tpls = {
dlist: ''
}, ipod.defaults = {
dir: "D:/HD2A",
jsonrpc: "http://127.0.0.1:16800/jsonrpc",
proxy: "http://127.0.0.1:1081"
}, ipod.aria2 = u.load("aria2", ipod.defaults), document.addEventListener("DOMContentLoaded", () => {
location.pathname.startsWith("/watch") && ytbdl(unsafeWindow.ytplayer.config.args.raw_player_response);
});
}
}();