// ==UserScript==
// @name bilibili视频下载
// @namespace https://github.com/injahow
// @version 2.3.5
// @description 支持Web、RPC、Blob、Aria等下载方式;支持flv、dash、mp4视频格式;支持下载港区番剧;支持会员下载;支持换源播放,自动切换为高清视频源
// @author injahow
// @copyright 2021, injahow (https://github.com/injahow)
// @license MIT
// @source https://github.com/injahow/user.js
// @supportURL https://github.com/injahow/user.js/issues
// @match *://www.bilibili.com/video/av*
// @match *://www.bilibili.com/video/BV*
// @match *://www.bilibili.com/medialist/play/*
// @match *://www.bilibili.com/bangumi/play/ep*
// @match *://www.bilibili.com/bangumi/play/ss*
// @match *://www.bilibili.com/cheese/play/ep*
// @match *://www.bilibili.com/cheese/play/ss*
// @match https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png*
// @require https://static.hdslb.com/js/jquery.min.js
// @icon https://static.hdslb.com/images/favicon.ico
// @compatible chrome
// @compatible firefox
// @grant none
// @downloadURL none
// ==/UserScript==
/* globals $ waitForKeyElements */
// @[ You can find all source codes in GitHub repo ]
(function() {
"use strict";
var __webpack_modules__ = {
99: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
__webpack_require__.d(__webpack_exports__, {
v0: function() {
return Message;
},
_p: function() {
return MessageBox;
},
N5: function() {
return initMessage;
}
});
var ui_scroll = __webpack_require__(537), message = '
'),
$(bili_player_id).hide()) : $("#bilibili-player")[0] ? (bili_player_id = "#bilibili-player",
$(bili_player_id).before('
'),
$(bili_player_id).hide()) : "cheese" === video.type() && ($('div.bpx-player[data-injector="nano"]')[0] ? ($("#pay-mask").hide(),
$("#bofqi").show(), bili_player_id = 'div.bpx-player[data-injector="nano"]', $(bili_player_id).before('
'),
$(bili_player_id).hide()) : (bili_player_id = "#pay-mask", $(bili_player_id).html('
'))),
$("#player_mask_module").hide(), api.get_subtitle_url(0, (function dplayer_init() {
var subtitle_url = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";
if (window.bp_dplayer = new runtime_lib.bc({
container: $("#bp_dplayer")[0],
mutex: !1,
volume: 1,
autoplay: !0,
video: {
url: url,
type: "auto"
},
subtitle: {
url: subtitle_url,
type: "webvtt",
fontSize: "35px",
bottom: "5%",
color: "#fff"
},
danmaku: !0,
apiBackend: {
read: function read(options) {
request_danmaku(options, video.base().cid());
},
send: function send(options) {
options.error("此脚本无法将弹幕同步到云端");
}
},
contextmenu: [ {
text: "脚本信息",
link: "https://github.com/injahow/user.js"
}, {
text: "脚本作者",
link: "https://injahow.com"
} ]
}), url_2 && "#" !== url_2) {
$("body").append('
'), window.bp_dplayer_2 = new runtime_lib.bc({
container: $("#bp_dplayer_2")[0],
mutex: !1,
volume: 1,
autoplay: !0,
video: {
url: url_2,
type: "auto"
}
});
var _ref = [ window.bp_dplayer, window.bp_dplayer_2 ], bp_dplayer = _ref[0], bp_dplayer_2 = _ref[1];
bp_dplayer.on("play", (function() {
!bp_dplayer.paused && bp_dplayer_2.play();
})), bp_dplayer.on("playing", (function() {
!bp_dplayer.paused && bp_dplayer_2.play();
})), bp_dplayer.on("timeupdate", (function() {
Math.abs(bp_dplayer.video.currentTime - bp_dplayer_2.video.currentTime) > 1 && (bp_dplayer_2.pause(),
bp_dplayer_2.seek(bp_dplayer.video.currentTime)), !bp_dplayer.paused && bp_dplayer_2.play();
})), bp_dplayer.on("seeking", (function() {
bp_dplayer_2.pause(), bp_dplayer_2.seek(bp_dplayer.video.currentTime);
})), bp_dplayer.on("waiting", (function() {
bp_dplayer_2.pause(), bp_dplayer_2.seek(bp_dplayer.video.currentTime);
})), bp_dplayer.on("pause", (function() {
bp_dplayer_2.pause(), bp_dplayer_2.seek(bp_dplayer.video.currentTime);
})), bp_dplayer.on("suspend", (function() {
bp_dplayer_2.speed(bp_dplayer.video.playbackRate);
})), bp_dplayer.on("volumechange", (function() {
bp_dplayer_2.volume(bp_dplayer.video.volume), bp_dplayer_2.video.muted = bp_dplayer.video.muted;
}));
}
}));
},
danmaku: {
config: danmaku_config
}
};
function check_defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0,
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var check = new (function() {
function Check() {
!function check_classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, Check), this.aid = "", this.cid = "", this.q = "", this.epid = "";
}
return function check_createClass(Constructor, protoProps, staticProps) {
return protoProps && check_defineProperties(Constructor.prototype, protoProps),
staticProps && check_defineProperties(Constructor, staticProps), Object.defineProperty(Constructor, "prototype", {
writable: !1
}), Constructor;
}(Check, [ {
key: "refresh",
value: function refresh() {
console.log("refresh..."), $("#video_download").hide(), $("#video_download_2").hide(),
player.recover_player();
try {
var vb = video.base();
this.aid = vb.aid(), this.cid = vb.cid(), this.epid = vb.epid(), this.q = video.get_quality().q,
window.bp_episodes = null;
} catch (err) {
console.log(err);
}
}
} ]), Check;
}()), ui_scroll = __webpack_require__(537);
function download_createForOfIteratorHelper(o, allowArrayLike) {
var it = "undefined" != typeof Symbol && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = function download_unsupportedIterableToArray(o, minLen) {
if (!o) return;
if ("string" == typeof o) return download_arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
"Object" === n && o.constructor && (n = o.constructor.name);
if ("Map" === n || "Set" === n) return Array.from(o);
if ("Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return download_arrayLikeToArray(o, minLen);
}(o)) || allowArrayLike && o && "number" == typeof o.length) {
it && (o = it);
var i = 0, F = function F() {};
return {
s: F,
n: function n() {
return i >= o.length ? {
done: !0
} : {
done: !1,
value: o[i++]
};
},
e: function e(_e) {
throw _e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var err, normalCompletion = !0, didErr = !1;
return {
s: function s() {
it = it.call(o);
},
n: function n() {
var step = it.next();
return normalCompletion = step.done, step;
},
e: function e(_e2) {
didErr = !0, err = _e2;
},
f: function f() {
try {
normalCompletion || null == it.return || it.return();
} finally {
if (didErr) throw err;
}
}
};
}
function download_arrayLikeToArray(arr, len) {
(null == len || len > arr.length) && (len = arr.length);
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function rpc_type() {
return config_config.rpc_domain.match("https://") || config_config.rpc_domain.match(/localhost|127\.0\.0\.1/) ? "post" : "ariang";
}
var download_rpc_clicked = !1;
function open_ariang(rpc) {
var hash_tag = rpc ? "#!/settings/rpc/set/".concat(rpc.domain.replace("://", "/"), "/").concat(rpc.port, "/jsonrpc/").concat(window.btoa(rpc.token)) : "", url = config_config.ariang_host + hash_tag, a = document.createElement("a");
a.setAttribute("target", "_blank"), a.setAttribute("onclick", "window.bp_aria2_window=window.open('".concat(url, "');")),
a.click();
}
var download_blob_clicked = !1, need_show_progress = !0;
function download_blob(url, filename) {
if (download_blob_clicked) return message.v0.miaow(), void (need_show_progress = !0);
var xhr = new XMLHttpRequest;
xhr.open("get", url), xhr.responseType = "blob", xhr.onload = function() {
if (200 === this.status || 304 === this.status) {
if ("msSaveOrOpenBlob" in navigator) return void navigator.msSaveOrOpenBlob(this.response, filename);
var blob_url = URL.createObjectURL(this.response), a = document.createElement("a");
a.style.display = "none", a.href = blob_url, a.download = filename, a.click(), URL.revokeObjectURL(blob_url);
}
}, need_show_progress = !0, xhr.onprogress = function(evt) {
if (4 != this.state) {
var loaded = evt.loaded, tot = evt.total;
!function show_progress(_ref5) {
var total = _ref5.total, loaded = _ref5.loaded, percent = _ref5.percent;
need_show_progress && message._p.alert("文件大小:".concat(Math.floor(total / 1048576), "MB(").concat(total, "Byte)
") + "已经下载:".concat(Math.floor(loaded / 1048576), "MB(").concat(loaded, "Byte)
") + "当前进度:".concat(percent, "%
下载中请勿操作浏览器!"), (function() {
need_show_progress = !1, message._p.alert("注意:刷新或离开页面会导致下载取消!
再次点击下载按钮可查看下载进度。");
})), total === loaded && (message._p.alert("下载完成,请等待浏览器保存!"), download_blob_clicked = !1);
}({
total: tot,
loaded: loaded,
percent: Math.floor(100 * loaded / tot)
});
}
}, xhr.send(), download_blob_clicked = !0, message.v0.info("准备开始下载");
}
function _download_danmaku_ass(cid, title) {
var return_type = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, callback = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null;
(0, ajax.h)({
url: "https://api.bilibili.com/x/v1/dm/list.so?oid=".concat(cid),
dataType: "text"
}).then((function(result) {
var result_dom = $(result.replace(/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]/g, ""));
if (!result_dom || !result_dom.find("d")[0]) return "callback" === return_type && callback ? void callback() : void message.v0.warning("未发现弹幕");
var danmaku_data = result_dom.find("d").map((function(i, el) {
var item = $(el), p = item.attr("p").split(","), type = 0;
return "4" === p[1] ? type = 2 : "5" === p[1] && (type = 1), [ {
time: parseFloat(p[0]),
type: type,
color: parseInt(p[3]),
text: item.text()
} ];
})).get();
danmaku_data.sort((function(a, b) {
return a.time - b.time;
}));
var _step3, dialogue = function dialogue(danmaku, scroll_id, fix_id) {
var text = danmaku.text, time = danmaku.time, commands = [ 0 === danmaku.type ? function scrollCommand(top, left_a, left_b) {
return "\\move(".concat(left_a, ",").concat(top, ",").concat(left_b, ",").concat(top, ")");
}(50 * (1 + Math.floor(15 * Math.random())), 1920 + 50 * danmaku.text.length / 2, 0 - 50 * danmaku.text.length / 2) : function fixCommand(top, left) {
return "\\pos(".concat(left, ",").concat(top, ")");
}(50 * (1 + fix_id % 15), 960), function isWhite(color) {
return 16777215 === color;
}(danmaku.color) ? "" : function colorCommand(color) {
return "\\c&H".concat(((255 & color) << 16 | (color >> 8 & 255) << 8 | color >> 16 & 255).toString(16), "&");
}(danmaku.color) ], formatTime = function formatTime(seconds) {
var div = function div(i, j) {
return Math.floor(i / j);
}, pad = function pad(n) {
return n < 10 ? "0" + n : "" + n;
}, integer = Math.floor(seconds), hour = div(integer, 3600), minute = div(integer, 60) % 60, second = integer % 60, minorSecond = Math.floor(100 * (seconds - integer));
return "".concat(hour, ":").concat(pad(minute), ":").concat(pad(second), ".").concat(minorSecond);
}, fields = [ 0, formatTime(time), formatTime(time + (0 === danmaku.type ? 8 : 4)), "Medium", "", "0", "0", "0", "", "{" + commands.join("") + "}" + function encode(text) {
return text.replace(/\{/g, "{").replace(/\}/g, "}").replace(/\r|\n/g, "");
}(text) ];
return "Dialogue: " + fields.join(",");
}, content = [ "[Script Info]", "; Script generated by injahow/user.js", "; https://github.com/injahow/user.js", "Title: ".concat(title), "ScriptType: v4.00+", "PlayResX: ".concat(1920), "PlayResY: ".concat(1080), "Timer: 10.0000", "WrapStyle: 2", "ScaledBorderAndShadow: no", "", "[V4+ Styles]", "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding", "Style: Small,微软雅黑,36,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,0,0,0,0,100,100,0,0,1,1.2,0,5,0,0,0,0", "Style: Medium,微软雅黑,52,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,0,0,0,0,100,100,0,0,1,1.2,0,5,0,0,0,0", "Style: Large,微软雅黑,64,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,0,0,0,0,100,100,0,0,1,1.2,0,5,0,0,0,0", "Style: Larger,微软雅黑,72,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,0,0,0,0,100,100,0,0,1,1.2,0,5,0,0,0,0", "Style: ExtraLarge,微软雅黑,90,&H66FFFFFF,&H66FFFFFF,&H66000000,&H66000000,0,0,0,0,100,100,0,0,1,1.2,0,5,0,0,0,0", "", "[Events]", "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text" ], fix_id = 0, _iterator3 = download_createForOfIteratorHelper(danmaku_data);
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
var danmaku = _step3.value;
0 === danmaku.type ? 0 : fix_id++, content.push(dialogue(danmaku, 0, fix_id));
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
var data = content.join("\n");
if (null === return_type || "file" === return_type) {
var blob_url = URL.createObjectURL(new Blob([ data ], {
type: "text/ass"
})), a = document.createElement("a");
a.style.display = "none", a.href = blob_url, a.download = title + ".ass", a.click(),
URL.revokeObjectURL(blob_url);
} else "callback" === return_type && callback && callback(data);
})).catch((function(_) {
"callback" === return_type && callback && callback();
}));
}
function download_danmaku_ass(cid, title) {
_download_danmaku_ass(cid, title, "file");
}
function download_subtitle_vtt() {
var p = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0, file_name = arguments.length > 1 ? arguments[1] : void 0, download_subtitle = function download_subtitle(blob_url) {
if (blob_url) {
var a = document.createElement("a");
a.setAttribute("target", "_blank"), a.setAttribute("href", blob_url), a.setAttribute("download", file_name + ".vtt"),
a.click(), URL.revokeObjectURL(blob_url);
} else message.v0.warning("未发现字幕");
};
api.get_subtitle_url(p, download_subtitle);
}
function download_blob_zip(blob_data, filename) {
if (blob_data) {
var blob_url = URL.createObjectURL(blob_data), a = document.createElement("a");
a.setAttribute("target", "_blank"), a.setAttribute("href", blob_url), a.setAttribute("download", filename + ".zip"),
a.click(), URL.revokeObjectURL(blob_url);
}
}
function download_danmaku_ass_zip(videos, zip) {
if (videos) {
if (0 === videos.length) return 0 === Object.keys(zip.files).length ? void message.v0.warning("未发现弹幕") : void zip.generateAsync({
type: "blob"
}).then((function(data) {
return download_blob_zip(data, video.base().name + "_ass");
}));
var videos_pop = videos.pop();
_download_danmaku_ass(videos_pop.cid, videos_pop.filename, "callback", (function(data) {
data && zip.file(videos_pop.filename + ".ass", data), download_danmaku_ass_zip(videos, zip);
}));
}
}
function download_subtitle_vtt_zip(videos, zip) {
if (videos) {
if (0 === videos.length) return 0 === Object.keys(zip.files).length ? void message.v0.warning("未发现字幕") : void zip.generateAsync({
type: "blob"
}).then((function(data) {
return download_blob_zip(data, video.base().name + "_vtt");
}));
var videos_pop = videos.pop();
api.get_subtitle_data(videos_pop.p, (function(data) {
data && zip.file(videos_pop.filename + ".vtt", data), download_subtitle_vtt_zip(videos, zip);
}));
}
}
function format(url) {
return url.match(".flv") ? ".flv" : url.match(".m4s") ? "_video.mp4" : (url.match(".mp4"),
".mp4");
}
var Download = {
url_format: format,
download: function download(url, name, type) {
var filename = (name = name.replace(/[\/\\*|]+/g, "-").replace(/:/g, ":").replace(/\?/g, "?").replace(/"/g, "'").replace(//g, "》")) + format(url);
"blob" === type ? download_blob(url, filename) : "rpc" === type && function download_rpc(url, filename) {
var type = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "post";
if (download_rpc_clicked) message.v0.miaow(); else {
download_rpc_clicked = !0;
var rpc = {
domain: config_config.rpc_domain,
port: config_config.rpc_port,
token: config_config.rpc_token,
dir: config_config.rpc_dir
}, json_rpc = {
id: window.btoa("BParse_".concat(Date.now(), "_").concat(Math.random())),
jsonrpc: "2.0",
method: "aria2.addUri",
params: [ "token:".concat(rpc.token), [ url ], {
dir: rpc.dir,
out: filename,
header: [ "User-Agent: ".concat(window.navigator.userAgent), "Referer: ".concat(window.location.href) ]
} ]
};
if (message.v0.info("发送RPC下载请求"), "post" === type) (0, ajax.h)({
url: "".concat(rpc.domain, ":").concat(rpc.port, "/jsonrpc"),
type: "POST",
dataType: "json",
data: JSON.stringify(json_rpc)
}).then((function(res) {
res.result ? message.v0.success("RPC请求成功") : message.v0.warning("请检查RPC参数");
})).catch((function(_) {
message.v0.error("请检查RPC服务配置");
})).finally((function(_) {
return download_rpc_clicked = !1;
})); else if ("ariang" === type) {
var bp_aria2_window = window.bp_aria2_window, time = 100;
bp_aria2_window && !bp_aria2_window.closed || (open_ariang(), time = 3e3), setTimeout((function() {
var bp_aria2_window = window.bp_aria2_window, aria2_header = "header=User-Agent:".concat(window.navigator.userAgent, "&header=Referer:").concat(window.location.href), task_hash = "#!/new/task?url=".concat(window.btoa(url), "&out=").concat(encodeURIComponent(filename), "&").concat(aria2_header);
bp_aria2_window && !bp_aria2_window.closed ? (bp_aria2_window.location.href = config_config.ariang_host + task_hash,
message.v0.success("RPC请求发送成功")) : message.v0.warning("AriaNG页面未打开"), download_rpc_clicked = !1;
}), time);
}
}
}(url, filename, rpc_type());
},
download_all: function download_all() {
var vb = video.base(), _ref = [ video.get_quality().q, vb.total() ], q = _ref[0], total = _ref[1];
$("body").on("click", 'input[name="option_video"]', (function() {
$(this).is(":checked") ? $(this).parent().css("color", "rgba(0,0,0,1)") : $(this).parent().css("color", "rgba(0,0,0,0.5)");
}));
for (var video_html = "", i = 0; i < total; i++) video_html += "" + '
");
var all_checked = !1;
$("body").on("click", "button#checkbox_btn", (function() {
all_checked ? (all_checked = !1, $('input[name="option_video"]').prop("checked", all_checked),
$('input[name="option_video"]').parent().css("color", "rgba(0,0,0,0.5)")) : (all_checked = !0,
$('input[name="option_video"]').prop("checked", all_checked), $('input[name="option_video"]').parent().css("color", "rgb(0,0,0)"));
}));
var _step, option_support_html = "", _iterator = download_createForOfIteratorHelper(video.get_quality_support());
try {
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
var item = _step.value;
option_support_html += '
");
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
var msg = "" + '
\n \n \n
\n
\n \n \n
\n
\n \n \n \n \n 字幕\n \n \n \n 弹幕\n \n
\n
\n 为避免请求被拦截,设置了延时且不支持下载无法播放的视频;请勿频繁下载过多视频,可能触发风控导致不可再下载!\n \n
\n ').concat(video_html, "\n
\n
").concat("medialist" === video.type() ? "不支持多页视频,若需要请到视频原播放页面下载" : "", '
\n
\n \n
');
function download_videos(videos, i, video_urls) {
if (videos.length) if (i < videos.length) {
var _video = videos[i], _msg = "第".concat(i + 1, "(").concat(i + 1, "/").concat(videos.length, ")个视频");
message._p.alert("".concat(_msg, ":获取中...")), setTimeout((function() {
api.get_urls(_video.p, _video.q, _video.format, (function success(res) {
if (!res.code) {
message.v0.success("请求成功" + (res.times ? "
今日剩余请求次数".concat(res.times) : "")),
message._p.alert("".concat(_msg, ":获取成功!"));
var _ref4 = [ res.url, format(res.url), rpc_type() ], url = _ref4[0], video_format = _ref4[1], type = _ref4[2];
"post" === type ? (video_urls.push({
url: url,
filename: _video.filename + video_format
}), video_urls.length > 3 && (download_rpc_all(video_urls), video_urls.length = 0)) : "ariang" === type && function download_rpc_ariang_one(video) {
var bp_aria2_window = window.bp_aria2_window, time = 100;
bp_aria2_window && !bp_aria2_window.closed || (open_ariang(), time = 3e3);
setTimeout((function() {
var bp_aria2_window = window.bp_aria2_window, aria2_header = "header=User-Agent:".concat(window.navigator.userAgent, "&header=Referer:").concat(window.location.href);
if (bp_aria2_window && !bp_aria2_window.closed) {
var task_hash = "#!/new/task?url=".concat(window.btoa(video.url), "&out=").concat(encodeURIComponent(video.filename), "&").concat(aria2_header);
bp_aria2_window.location.href = config_config.ariang_host + task_hash, message.v0.success("RPC请求成功");
} else message.v0.warning("请检查RPC参数");
}), time);
}({
url: url,
filename: _video.filename + video_format
});
}
setTimeout((function() {
download_videos(videos, ++i, video_urls);
}), 3e3);
}), (function error() {
download_videos(videos, ++i, video_urls);
}));
}), 3e3);
} else message._p.alert("视频地址请求完成!"), "post" === rpc_type() && video_urls.length > 0 && (download_rpc_all(video_urls),
video_urls.length = 0);
}
function download_rpc_all(video_urls) {
var _step2, rpc = {
domain: config_config.rpc_domain,
port: config_config.rpc_port,
token: config_config.rpc_token,
dir: config_config.rpc_dir
}, json_rpc = [], _iterator2 = download_createForOfIteratorHelper(video_urls);
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
var _video2 = _step2.value;
json_rpc.push({
id: window.btoa("BParse_".concat(Date.now(), "_").concat(Math.random())),
jsonrpc: "2.0",
method: "aria2.addUri",
params: [ "token:".concat(rpc.token), [ _video2.url ], {
dir: rpc.dir,
out: _video2.filename,
header: [ "User-Agent: ".concat(window.navigator.userAgent), "Referer: ".concat(window.location.href) ]
} ]
});
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
message.v0.info("发送RPC下载请求"), (0, ajax.h)({
url: "".concat(rpc.domain, ":").concat(rpc.port, "/jsonrpc"),
type: "POST",
dataType: "json",
data: JSON.stringify(json_rpc)
}).then((function(res) {
res.length === json_rpc.length ? message.v0.success("RPC请求成功") : message.v0.warning("请检查RPC参数");
})).catch((function(_) {
message.v0.error("请检查RPC服务配置");
}));
}
message._p.confirm(msg, (function() {
for (var dl_quality = $("#dl_quality").val() || q, _ref2 = [ $("#dl_video").is(":checked"), $("#dl_subtitle").is(":checked"), $("#dl_danmaku").is(":checked") ], dl_video = _ref2[0], dl_subtitle = _ref2[1], dl_danmaku = _ref2[2], videos = [], _i = 0; _i < total; _i++) if ($("input#option_".concat(_i)).is(":checked")) {
var p = _i + 1, _ref3 = [ vb.cid(p), vb.filename(p) ], cid = _ref3[0], filename = _ref3[1], _format = $("#dl_format").val();
videos.push({
cid: cid,
p: p,
q: dl_quality,
format: _format,
filename: filename
});
}
dl_video && download_videos(videos, 0, []), dl_subtitle && (1 === videos.length ? download_subtitle_vtt(videos[0].p, videos[0].filename) : download_subtitle_vtt_zip([].concat(videos), new runtime_lib.$c)),
dl_danmaku && (1 === videos.length ? download_danmaku_ass(videos[0].cid, videos[0].filename) : download_danmaku_ass_zip([].concat(videos), new runtime_lib.$c));
})), $("body").on("click", 'input[name="dl_option"]', (function() {
$(this).is(":checked") ? $(this).parent().css("color", "rgba(0,0,0,1)") : $(this).parent().css("color", "rgba(0,0,0,0.5)");
})), $("#dl_quality").val(q > 120 ? 80 : q);
},
download_danmaku_ass: download_danmaku_ass,
download_subtitle_vtt: download_subtitle_vtt,
open_ariang: open_ariang
}, config = '
', config_config = {
base_api: "https://api.injahow.cn/bparse/",
request_type: "auto",
format: "flv",
host_key: "0",
replace_force: "0",
auth: "0",
download_type: "web",
rpc_domain: "http://localhost",
rpc_port: "16800",
rpc_token: "",
rpc_dir: "D:/",
aria2c_connection_level: "min",
ariang_host: "http://ariang.injahow.com/",
auto_download: "0",
video_quality: "0",
danmaku_speed: "15",
danmaku_fontsize: "22"
}, default_config = Object.assign({}, config_config), hostMap = {
ks3: "upos-sz-mirrorks3.bilivideo.com",
ks3b: "upos-sz-mirrorks3b.bilivideo.com",
ks3c: "upos-sz-mirrorks3c.bilivideo.com",
ks32: "upos-sz-mirrorks32.bilivideo.com",
kodo: "upos-sz-mirrorkodo.bilivideo.com",
kodob: "upos-sz-mirrorkodob.bilivideo.com",
cos: "upos-sz-mirrorcos.bilivideo.com",
cosb: "upos-sz-mirrorcosb.bilivideo.com",
bos: "upos-sz-mirrorbos.bilivideo.com",
wcs: "upos-sz-mirrorwcs.bilivideo.com",
wcsb: "upos-sz-mirrorwcsb.bilivideo.com",
hw: "upos-sz-mirrorhw.bilivideo.com",
hwb: "upos-sz-mirrorhwb.bilivideo.com",
upbda2: "upos-sz-upcdnbda2.bilivideo.com",
upws: "upos-sz-upcdnws.bilivideo.com",
uptx: "upos-sz-upcdntx.bilivideo.com",
uphw: "upos-sz-upcdnhw.bilivideo.com",
js: "upos-tf-all-js.bilivideo.com",
hk: "cn-hk-eq-bcache-01.bilivideo.com",
akamai: "upos-hz-mirrorakam.akamaized.net"
}, videoQualityMap = {
120: "4K 超清",
116: "1080P 60帧",
112: "1080P 高码率",
80: "1080P 高清",
74: "720P 60帧",
64: "720P 高清",
48: "720P 高清(MP4)",
32: "480P 清晰",
16: "360P 流畅"
}, help_clicked = !1, config_functions = {
save_config: function save_config() {
var old_config;
try {
old_config = JSON.parse(store.get("config_str")), store.set("config_str", JSON.stringify(config_config));
} catch (err) {
old_config = Object.assign({}, config_config);
}
for (var _i = 0, _arr = [ "base_api", "format", "auth", "video_quality" ]; _i < _arr.length; _i++) {
var key = _arr[_i];
if (config_config[key] !== old_config[key]) {
$("#video_download").hide(), $("#video_download_2").hide();
break;
}
}
config_config.host_key !== old_config.host_key && (check.refresh(), $("#video_url").attr("href", "#"),
$("#video_url_2").attr("href", "#")), config_config.rpc_domain !== old_config.rpc_domain && (config_config.rpc_domain.match("https://") || config_config.rpc_domain.match(/(localhost|127\.0\.0\.1)/) || message._p.alert("检测到当前RPC不是localhost本地接口,即将跳转到AriaNg网页控制台页面;请查看控制台RPC接口参数是否正确,第一次加载可能较慢请耐心等待;配置好后即可使用脚本进行远程下载
使用期间不用关闭控制台页面!", (function() {
Download.open_ariang({
domain: config_config.rpc_domain,
port: config_config.rpc_port,
token: config_config.rpc_token
});
})));
for (var _i2 = 0, _arr2 = [ "danmaku_speed", "danmaku_fontsize" ]; _i2 < _arr2.length; _i2++) {
var _key = _arr2[_i2];
if (config_config[_key] !== old_config[_key]) {
player.danmaku.config();
break;
}
}
$("#bp_config").hide(), $("#bp_config").css("opacity", 0), ui_scroll.A.show();
},
reset_config: function reset_config() {
for (var key in default_config) "auth" !== key && (config_config[key] = default_config[key],
$("#".concat(key)).val(default_config[key]));
},
show_help: function show_help() {
help_clicked ? message.v0.miaow() : (help_clicked = !0, (0, ajax.h)({
url: "".concat(config_config.base_api, "/auth/v2/?act=help"),
dataType: "text"
}).then((function(res) {
res ? message._p.alert(res) : message.v0.warning("获取失败");
})).finally((function() {
return help_clicked = !1;
})));
},
show_login: function show_login() {
auth.login("1");
},
show_login_2: function show_login_2() {
auth.login("0");
},
show_logout: function show_logout() {
auth.logout();
},
show_login_help: function show_login_help() {
message._p.confirm("进行授权之后将能在远程请求时享有用户账号原有的权益,例如能够请求用户已经付费或承包的番剧,是否需要授权?", (function() {
auth.login();
}));
}
};
function auth_defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0,
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var Auth = function() {
function Auth() {
!function auth_classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, Auth), this.auth_clicked = !1;
}
return function auth_createClass(Constructor, protoProps, staticProps) {
return protoProps && auth_defineProperties(Constructor.prototype, protoProps), staticProps && auth_defineProperties(Constructor, staticProps),
Object.defineProperty(Constructor, "prototype", {
writable: !1
}), Constructor;
}(Auth, [ {
key: "checkLoginStatus",
value: function checkLoginStatus() {
var _this = this, _ref = [ store.get("auth_id"), store.get("auth_sec"), store.get("access_key"), store.get("auth_time") || "0" ], auth_id = _ref[0], auth_sec = _ref[1], access_key = _ref[2], auth_time = _ref[3];
access_key && (user.is_login && (config_config.base_api !== store.get("pre_base_api") || Date.now() - parseInt(auth_time) > 864e5) && (0,
ajax.h)({
url: "https://api.bilibili.com/x/space/myinfo?access_key=".concat(access_key),
type: "GET",
dataType: "json"
}).then((function(res) {
res.code ? message._p.alert("授权已过期,准备重新授权", (function() {
_this.reLogin();
})) : (store.set("auth_time", Date.now()), (0, ajax.h)({
url: "".concat(config_config.base_api, "/auth/v2/?act=check&auth_id=").concat(auth_id, "&auth_sec=").concat(auth_sec, "&access_key=").concat(access_key),
type: "GET",
dataType: "json"
}).then((function(res) {
res.code && message._p.alert("检查失败,准备重新授权", (function() {
_this.reLogin();
}));
})));
})), store.set("pre_base_api", config_config.base_api));
}
}, {
key: "_login",
value: function _login(resolve) {
var _this2 = this;
this.auth_clicked ? message.v0.miaow() : (this.auth_clicked = !0, (0, ajax.h)({
url: "https://passport.bilibili.com/login/app/third?appkey=27eb53fc9058f8c3&api=https%3A%2F%2Fwww.mcbbs.net%2Ftemplate%2Fmcbbs%2Fimage%2Fspecial_photo_bg.png&sign=04224646d1fea004e79606d3b038c84a",
xhrFields: {
withCredentials: !0
},
type: "GET",
dataType: "json"
}).then(resolve).finally((function(_) {
return _this2.auth_clicked = !1;
})));
}
}, {
key: "login",
value: function login() {
var auto = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "1", do_login = "1" === auto ? this.loginAuto.bind(this) : this.loginManual.bind(this);
store.get("auth_id") ? message._p.confirm("发现授权记录,是否重新授权?", do_login) : do_login();
}
}, {
key: "reLogin",
value: function reLogin() {
store.set("auth_id", ""), store.set("auth_sec", ""), store.set("access_key", ""),
store.set("auth_time", "0"), this.loginAuto();
}
}, {
key: "loginAuto",
value: function loginAuto() {
this._login((function(res) {
res.data.has_login ? $("body").append("
")) : message._p.confirm("必须登录B站才能正常授权,是否登陆?", (function() {
location.href = "https://passport.bilibili.com/login";
}));
}));
}
}, {
key: "loginManual",
value: function loginManual() {
this._login((function(res) {
if (res.data.has_login) {
var msg = "" + "请点击
授权地址\n 打开一个新窗口,正常情况新窗口应该显示一个图片,请将该窗口地址栏的URL链接复制到当前文本框中
\n
然后点击确定即可");
message._p.alert(msg, (function() {
var auth_url = $("#auth_url").val(), auth_id = store.get("auth_id") || "", auth_sec = store.get("auth_sec") || "";
(0, ajax.h)({
url: auth_url.replace("https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png?", "".concat(config_config.base_api, "/auth/v2/?act=login&auth_id=").concat(auth_id, "&auth_sec=").concat(auth_sec, "&")),
type: "GET",
dataType: "json"
}).then((function(res) {
res.code ? message.v0.warning("授权失败") : (message.v0.success("授权成功"), res.auth_id && res.auth_sec && (store.set("auth_id", res.auth_id),
store.set("auth_sec", res.auth_sec)), store.set("access_key", new URL(auth_url).searchParams.get("access_key")),
store.set("auth_time", Date.now()), $("#auth").val("1"), config_config.auth = "1");
}));
}));
} else message._p.confirm("必须登录B站才能正常授权,是否登陆?", (function() {
location.href = "https://passport.bilibili.com/login";
}));
}));
}
}, {
key: "logout",
value: function logout() {
var _this3 = this;
if (store.get("auth_id")) if (this.auth_clicked) message.v0.miaow(); else {
var _ref2 = [ store.get("auth_id"), store.get("auth_sec") ], auth_id = _ref2[0], auth_sec = _ref2[1];
(0, ajax.h)({
url: "".concat(config_config.base_api, "/auth/v2/?act=logout&auth_id=").concat(auth_id, "&auth_sec=").concat(auth_sec),
type: "GET",
dataType: "json"
}).then((function(res) {
res.code ? message.v0.warning("取消失败") : (message.v0.success("取消成功"), store.set("auth_id", ""),
store.set("auth_sec", ""), store.set("auth_time", "0"), store.set("access_key", ""),
$("#auth").val("0"), config_config.auth = "0");
})).finally((function(_) {
return _this3.auth_clicked = !1;
}));
} else message._p.alert("没有发现授权记录");
}
}, {
key: "initAuth",
value: function initAuth() {
var _this4 = this;
window.addEventListener("message", (function(e) {
if ("string" == typeof e.data && "bilibili-parse-login-credentials" === e.data.split(":")[0]) {
$("iframe#auth_iframe").remove();
var url = e.data.split(": ")[1], _ref3 = [ store.get("auth_id"), store.get("auth_sec") ], auth_id = _ref3[0], auth_sec = _ref3[1];
(0, ajax.h)({
url: url.replace("https://www.mcbbs.net/template/mcbbs/image/special_photo_bg.png?", "".concat(config_config.base_api, "/auth/v2/?act=login&auth_id=").concat(auth_id, "&auth_sec=").concat(auth_sec, "&")),
type: "GET",
dataType: "json"
}).then((function(res) {
res.code ? message.v0.warning("授权失败") : (message.v0.success("授权成功"), res.auth_id && res.auth_sec && (store.set("auth_id", res.auth_id),
store.set("auth_sec", res.auth_sec)), store.set("access_key", new URL(url).searchParams.get("access_key")),
store.set("auth_time", Date.now()), $("#auth").val("1"), config_config.auth = "1");
})).finally((function(_) {
return _this4.auth_clicked = !1;
}));
}
}));
}
} ]), Auth;
}(), auth = new Auth;
function main_defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0,
"value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
}
}
var Main = function() {
function Main() {
!function main_classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}(this, Main), console.log("\n".concat(" %c bilibili-parse-download.user.js v", "2.3.5", " ").concat("12ac511", " %c https://github.com/injahow/user.js ", "\n", "\n"), "color: #fadfa3; background: #030307; padding:5px 0;", "background: #fadfa3; padding:5px 0;");
}
return function main_createClass(Constructor, protoProps, staticProps) {
return protoProps && main_defineProperties(Constructor.prototype, protoProps), staticProps && main_defineProperties(Constructor, staticProps),
Object.defineProperty(Constructor, "prototype", {
writable: !1
}), Constructor;
}(Main, [ {
key: "set_toolbar",
value: function set_toolbar() {
$("#arc_toolbar_report")[0] ? $("#arc_toolbar_report").after('
') : $("#toolbar_module")[0] ? $("#toolbar_module").after('
') : $("div.video-toolbar")[0] && $("div.video-toolbar").after('
');
}
}, {
key: "run",
value: function run() {
this.set_toolbar();
var api_url, api_url_temp, root_div = document.createElement("div");
root_div.id = "bp_root", document.body.append(root_div), function initConfig(el) {
var options = '
';
for (var k in hostMap) options += '
");
for (var _k in config = config.replace("{{host_key_options}}", options), options = '
',
videoQualityMap) options += '
");
config = config.replace("{{video_quality_options}}", options), el && $(el)[0] ? $(el).append(config) : $("body").append(config);
var config_str = store.get("config_str");
if (config_str) try {
var old_config = JSON.parse(config_str);
for (var key in old_config) Object.hasOwnProperty.call(config_config, key) && (config_config[key] = old_config[key]);
} catch (_unused) {
console.log("初始化脚本配置");
}
config_config.auth = store.get("auth_id") ? "1" : "0", store.set("config_str", JSON.stringify(config_config));
var _loop = function _loop(_key2) {
if ("auth" === _key2) return "continue";
$("#".concat(_key2)).on("input", (function(e) {
config_config[_key2] = e.delegateTarget.value;
}));
};
for (var _key2 in config_config) _loop(_key2);
for (var _k2 in config_functions) {
var e = $("#".concat(_k2))[0];
e && (e.onclick = config_functions[_k2]);
}
for (var _key3 in config_config) $("#".concat(_key3)).val(config_config[_key3]);
window.onbeforeunload = function() {
var bp_aria2_window = window.bp_aria2_window;
bp_aria2_window && !bp_aria2_window.closed && bp_aria2_window.close();
};
}("#".concat(root_div.id)), (0, message.N5)("#".concat(root_div.id)), user.lazyInit(),
auth.initAuth(), auth.checkLoginStatus(), check.refresh(), $("#".concat(root_div.id)).append('
'),
$("#".concat(root_div.id)).append('
'),
$("#".concat(root_div.id)).append('
');
var e = {
setting_btn: function setting_btn() {
for (var key in user.lazyInit(!0), config_config) $("#".concat(key)).val(config_config[key]);
$("#bp_config").show(), $("#bp_config").animate({
opacity: "1"
}, 300), ui_scroll.A.hide();
},
download_danmaku: function download_danmaku() {
var vb = video.base();
Download.download_danmaku_ass(vb.cid(), vb.filename());
},
download_subtitle: function download_subtitle() {
Download.download_subtitle_vtt(0, video.base().filename());
},
video_download_all: function video_download_all() {
user.lazyInit(!0), store.get("auth_id") && store.get("auth_sec") ? "rpc" === config_config.download_type ? Download.download_all() : message._p.confirm("仅支持使用RPC接口批量下载,请确保RPC环境正常,是否继续?", (function() {
Download.download_all();
})) : message._p.confirm("批量下载仅支持授权用户使用RPC接口下载,是否进行授权?", (function() {
auth.login();
}));
},
video_download: function video_download() {
var type = config_config.download_type;
if ("web" === type) $("#video_url")[0].click(); else if ("a" === type) {
var _ref = [ $("#video_url").attr("href"), $("#video_url_2").attr("href") ], video_url_2 = _ref[1], msg = "建议使用IDM、FDM等软件安装其浏览器插件后,鼠标右键点击链接下载~
" + '
>视频地址<') + ("dash" === config_config.format ? '
>音频地址<') : "");
message._p.alert(msg);
} else if ("aria" === type) {
var file_name, file_name_2, _ref2 = [ $("#video_url").attr("href"), $("#video_url_2").attr("href") ], _video_url = _ref2[0], _video_url_ = _ref2[1], video_title = video.base().filename();
file_name = video_title + Download.url_format(_video_url), file_name_2 = video_title + "_audio.mp4";
var aria2_header = '--header "User-Agent: '.concat(window.navigator.userAgent, '" --header "Referer: ').concat(window.location.href, '"'), url_max_connection = 1, server_max_connection = 5;
switch (config_config.aria2c_connection_level) {
case "min":
url_max_connection = 1, server_max_connection = 5;
break;
case "mid":
url_max_connection = 16, server_max_connection = 8;
break;
case "max":
url_max_connection = 32, server_max_connection = 16;
}
var aria2c_max_concurrent_downloads = "--max-concurrent-downloads ".concat(url_max_connection), aria2c_max_connection_per_server = "--max-connection-per-server ".concat(server_max_connection), code = 'aria2c "'.concat(_video_url, '" --out "').concat(file_name, '" ').concat(aria2_header, " ").concat(aria2c_max_concurrent_downloads, " ").concat(aria2c_max_connection_per_server), code_2 = 'aria2c "'.concat(_video_url_, '" --out "').concat(file_name_2, '" ').concat(aria2_header, " ").concat(aria2c_max_concurrent_downloads, " ").concat(aria2c_max_connection_per_server), _msg = "点击文本框即可复制下载命令!
" + '视频:
') + ("dash" === config_config.format ? '音频:
') + '全部:
") : "");
!window.bp_clip_btn && (window.bp_clip_btn = function(id) {
$("#".concat(id)).select(), document.execCommand("copy") ? message.v0.success("复制成功") : message.v0.warning("复制失败");
}), message._p.alert(_msg);
} else {
var url = $("#video_url").attr("href"), filename = video.base().filename();
Download.download(url, filename, type);
}
},
video_download_2: function video_download_2() {
var type = config_config.download_type;
if ("web" === type) $("#video_url_2")[0].click(); else if ("a" === type) $("#video_download").click(); else if ("aria" === type) $("#video_download").click(); else {
var url = $("#video_url_2").attr("href"), filename = video.base().filename();
Download.download(url, filename, type);
}
},
bilibili_parse: function bilibili_parse() {
user.lazyInit(!0);
var vb = video.base(), _ref3 = [ vb.type, vb.aid(), vb.p(), vb.cid(), vb.epid() ], type = _ref3[0], aid = _ref3[1], p = _ref3[2], cid = _ref3[3], epid = _ref3[4], q = video.get_quality().q;
api_url = "".concat(config_config.base_api, "?av=").concat(aid, "&p=").concat(p, "&cid=").concat(cid, "&ep=").concat(epid, "&q=").concat(q, "&type=").concat(type, "&format=").concat(config_config.format, "&otype=json&_host=").concat(config_config.host_key, "&_req=").concat(config_config.request_type, "&_q=").concat(config_config.video_quality);
var _ref4 = [ store.get("auth_id"), store.get("auth_sec") ], auth_id = _ref4[0], auth_sec = _ref4[1];
if ("1" === config_config.auth && auth_id && auth_sec && (api_url += "&auth_id=".concat(auth_id, "&auth_sec=").concat(auth_sec)),
api_url !== api_url_temp || "local" === config_config.request_type) $("#video_url").attr("href", "#"),
$("#video_url_2").attr("href", "#"), api_url_temp = api_url, message.v0.info("开始请求"),
api.get_url((function(res) {
if (res && !res.code) {
var _url, _url_;
if (message.v0.success("请求成功"), res.times && message.v0.info("剩余请求次数:".concat(res.times)),
res.url) _url = res.url.replace("http://", "https://"), _url_ = "#"; else {
if (!res.video || !res.audio) return void message.v0.warning("数据错误");
_url = res.video.replace("http://", "https://"), _url_ = res.audio.replace("http://", "https://");
}
$("#video_url").attr("href", _url), $("#video_download").show(), "#" !== _url_ && ($("#video_url_2").attr("href", _url_),
$("#video_download_2").show()), (user.needReplace() || vb.is_limited() || "1" === config_config.replace_force) && player.replace_player(_url, _url_),
"1" === config_config.auto_download && $("#video_download").click();
}
})); else {
message.v0.miaow();
var url = $("#video_url").attr("href"), url_2 = $("#video_url_2").attr("href");
url && "#" !== url && ($("#video_download").show(), "dash" === config_config.format && $("#video_download_2").show(),
(user.needReplace() || vb.is_limited() || "1" === config_config.replace_force) && !$("#bp_dplayer")[0] && player.replace_player(url, url_2),
"1" === config_config.auto_download && $("#video_download").click());
}
}
};
window.bpd = e, $("body").on("click", "#setting_btn", e.setting_btn), $("body").on("click", "#download_danmaku", e.download_danmaku),
$("body").on("click", "#download_subtitle", e.download_subtitle), $("body").on("click", "#video_download_all", e.video_download_all),
$("body").on("click", "#video_download", e.video_download), $("body").on("click", "#video_download_2", e.video_download_2),
$("body").on("click", "#bilibili_parse", e.bilibili_parse), $("body").on("click", "a.router-link-active", (function() {
this !== $('li[class="on"]').find("a")[0] && check.refresh();
})), $("body").on("click", "li.ep-item", (function() {
check.refresh();
})), $("body").on("click", "button.bilibili-player-iconfont-next", (function() {
check.refresh();
}));
var bili_video_tag = player.bili_video_tag();
$(bili_video_tag)[0] && ($(bili_video_tag)[0].onended = function() {
check.refresh();
}), $("body").on("click", "li.bui-select-item", (function() {
check.refresh();
})), setInterval((function() {
(check.q !== video.get_quality().q || "cheese" === video.type() && check.epid !== video.base().epid()) && check.refresh();
}), 1e3), $("body").on("click", ".rec-list", (function() {
check.refresh();
})), $("body").on("click", ".bilibili-player-ending-panel-box-videos", (function() {
check.refresh();
})), setInterval((function() {
var vb = video.base();
check.aid === vb.aid() && check.cid === vb.cid() || check.refresh();
}), 3e3);
}
} ]), Main;
}(), main = Main;
window.bp_fun_locked || (window.bp_fun_locked = !0, null == location.href.match(/^https:\/\/www\.mcbbs\.net\/template\/mcbbs\/image\/special_photo_bg\.png/) ? $(".error-text")[0] || setTimeout((function() {
(new main).run();
}), 3e3) : location.href.match("access_key") && window !== window.parent && (window.stop(),
window.parent.postMessage("bilibili-parse-login-credentials: " + location.href, "*")));
}();
})();