版本比较
B 站视频下载工具
正文
增加 178 行删除 178 行
37 行未改动3839404142424344454612 行未改动5960616263636465666711 行未改动79808182838485868783848586878889909147 行未改动13914014114214314314414514614714814814915015115217 行未改动17017117217317417417517617717861 行未改动24024124224324424524424524624724824925025125125225325425525525625725825925926026126226326426526626726826926927027127227334 行未改动308309310311312312313314315316179 行未改动全部展开49649749849950050050150250350450550550650750850911 行未改动52152252352452552652552652752852953097 行未改动6286296306316326326336346356363 行未改动64064164264364464464564664764857 行未改动70670770870971071071171271371444 行未改动75976076176276376376476576676735 行未改动8038048058068078088078088098108118127 行未改动82082182282382482482582682782855 行未改动8848858868878888888898908918928938938948958968978988988999009019028 行未改动91191291391491591591691791891936 行未改动9569579589599609609619629639649 行未改动97497597697797897897998098198228 行未改动1011101210131014101510161017101510161017101810191020102177 行未改动109911001101110211031104110511031104110511061107110811094 行未改动111411151116111711181118111911201121112210 行未改动113311341135113611371137113811391140114115 行未改动1157115811591160116111611162116311641165120 行未改动全部展开128612871288128912901290129112921293129499 行未改动1394139513961397139813991398139914001401140214037 行未改动141114121413141414151415141614171418141917 行未改动1437143814391440144114421441144214431444144514461447144514461447144814491450145151 行未改动15031504150515061507150715081509151015111512151315141515151615151516151715181519152015211521152215231524152515261526152715281529153013 行未改动154415451546154715481548154915501551155226 行未改动157915801581158215831583158415851586158724 行未改动1612161316141615161616171616161716181619162016213 行未改动162516261627162816291630162916301631163216331634102 行未改动全部展开173717381739174017411741174217431744174570 行未改动181618171818181918201820182118221823182421 行未改动1846184718481849185018511850185118521853185418557 行未改动186318641865186618671867186818691870187117 行未改动188918901891189218931894189318941895189618971898189919001897189818991900190119021903190453 行未改动195819591960196119621962196319641965196615 行未改动1982198319841985198619861987198819891990199119921993199319941995199619978 行未改动20062007200820092010201020112012201320147 行未改动202220232024202520262026202720282029203078 行未改动2109211021112112211321132114211521152116211721182118211921202121212218 行未改动21412142214321442145214621452146214721482149215024 行未改动2175217621772178217921802181217921802181218221832184218575 行未改动226122622263226422652265226622672268226921 行未改动229122922293229422952295229622972298229912 行未改动23122313231423152316231623172318231923202320232123222323232423252326232723282328232923302331233251 行未改动238423852386238723882388238923902391239270 行未改动246324642465246624672467246824692470247121 行未改动2493249424952496249724982497249824992500250125027 行未改动251025112512251325142514251525162517251817 行未改动25362537253825392540254125402541254225432544254525462544254525462547254825492550145 行未改动全部展开269626972698269927002700270127022703270427052706270727082709270927102711271227133 行未改动271727182719272027212721272227232724272520 行未改动2746274727482749275027502751275227532754275527562757275727582759276027613 行未改动27652766276727682769276927702771277227735 行未改动277927802781278227832783278427852786278788 行未改动287628772878287928802880288128822883288470 行未改动295529562957295829592959296029612962296321 行未改动2985298629872988298929902989299029912992299329947 行未改动300230033004300530063006300730083009301017 行未改动3028302930303031303230333032303330343035303630373038303630373038303930403041304280 行未改动312331243125312631273127312831293130313131323133313431353135313631373138313916 行未改动315631573158315931603160316131623163316439 行未改动32043205320632073208320932083209321032113212321313 行未改动32273228322932303231323232313232323332343235323690 行未改动332733283329333033313331333233333334333533363337333833393340334033413342334333446 行未改动335133523353335433553355335633573358335943 行未改动340334043405340634073407340834093410341168 行未改动3480348134823483348434843485348634873488144 行未改动全部展开363336343635363636373637363836393640364154 行未改动36963697369836993700370037013702370337043 行未改动37083709371037113712371237133714371537163717371737183719372037203721372237233724372537263727372837273728372937303731373222 行未改动375537563757375837593759376037613762376337643763376437653766376737684 行未改动3773377437753776377737773778377937803781378237823783378437853786131 行未改动全部展开391839193920392139223922392339243925392643 行未改动397039713972397339743974397539763977397842 行未改动402140224023402440254025402640274028402912 行未改动40424043404440454046404640474048404940504050405140524053405475 行未改动41304131413241334134413441354136413741387 行未改动41464147414841494150415041514152415341544 行未改动415941604161416241634163416441654166416711 行未改动4179418041814182418341844183418441854186418741882 行未改动41914192419341944195419541964197419841993 行未改动42034204420542064207420842074208420942104211421250 行未改动426342644265426642674268426942674268426942704271427242734273427442754276427742784279428042814278427942804281428242834284428542864287428842874288428942904291429274 行未改动43674368436943704371437143724373437443758 行未改动4384438543864387438843884389439043914392439343944394439543964397439839 行未改动443844394440444144424442444344444445444642 行未改动448944904491449244934493449444954496449715 行未改动45134514451545164517451745184519452045214522452345244525452645264527452845294530453145324533453445354536453645374538453945406 行未改动454745484549455045514551455245534554455535 行未改动4591459245934594459545964597459545964597459845994600460130 行未改动37 行未改动 } function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } function _toPropertyKey(t) {12 行未改动 var user = new (function() { function User() { !function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }(this, User), this.is_login = !1, this.vip_status = 0, this.mid = "", this.uname = "", }(this, User), this.is_login = !1, this.vip_status = 0, this.mid = "", this.uname = "", this.has_init = !1, this.lazyInit(); } return function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {11 行未改动 } }, { key: "lazyInit", value: function lazyInit(last_init) { this.has_init || (window.__BILI_USER_INFO__ ? (this.is_login = window.__BILI_USER_INFO__.isLogin, this.vip_status = window.__BILI_USER_INFO__.vipStatus, this.mid = window.__BILI_USER_INFO__.mid || "", this.uname = window.__BILI_USER_INFO__.uname || "") : window.__BiliUser__ && (this.is_login = window.__BiliUser__.isLogin, window.__BiliUser__.cache ? (this.vip_status = window.__BiliUser__.cache.data.vipStatus, this.mid = window.__BiliUser__.cache.data.mid || "", this.uname = window.__BiliUser__.cache.data.uname || "") : (this.vip_status = 0, this.has_init || (window.__BILI_USER_INFO__ ? (this.is_login = window.__BILI_USER_INFO__.isLogin, this.vip_status = window.__BILI_USER_INFO__.vipStatus, this.mid = window.__BILI_USER_INFO__.mid || "", this.uname = window.__BILI_USER_INFO__.uname || "") : window.__BiliUser__ && (this.is_login = window.__BiliUser__.isLogin, window.__BiliUser__.cache ? (this.vip_status = window.__BiliUser__.cache.data.vipStatus, this.mid = window.__BiliUser__.cache.data.mid || "", this.uname = window.__BiliUser__.cache.data.uname || "") : (this.vip_status = 0, this.mid = "", this.uname = "")), this.has_init = last_init); } } ]), User; }());47 行未改动 } function cache_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, cache_toPropertyKey(o.key), o); } } function cache_createClass(e, r, t) { return r && cache_defineProperties(e.prototype, r), t && cache_defineProperties(e, t), return r && cache_defineProperties(e.prototype, r), t && cache_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }17 行未改动 return cache_createClass(CacheFactory, null, [ { key: "get", value: function get() { var name = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "default", cache = new Cache; return CacheFactory.map[name] instanceof Cache ? cache = CacheFactory.map[name] : CacheFactory.map[name] = cache, return CacheFactory.map[name] instanceof Cache ? cache = CacheFactory.map[name] : CacheFactory.map[name] = cache, cache; } }, { key: "setValue",61 行未改动 $("body").css("overflow", "hidden"); } }, message = '<div class="message-bg"></div> <div id="message_box"> <div class="message-box-mark"></div> <div class="message-box-bg"> <span style="font-size:20px"><b>提示:</b></span> <div id="message_box_context" style="margin:2% 0">...</div><br/><br/> <div class="message-box-btn"> <button name="affirm">确定</button> <button name="cancel">取消</button> </div> </div> </div> <style>.message-bg{position:fixed;float:right;right:0;top:2%;z-index:30000}.message{margin-bottom:15px;padding:2% 2%;width:300px;display:flex;margin-top:-70px;opacity:0}.message-success{background-color:#dfd;border-left:6px solid #4caf50}.message-error{background-color:#fdd;border-left:6px solid #f44336}.message-info{background-color:#e7f3fe;border-left:6px solid #0c86de}.message-warning{background-color:#ffc;border-left:6px solid #ffeb3b}.message-context{font-size:21px;word-wrap:break-word;word-break:break-all}.message-context p{margin:0}#message_box{opacity:0;display:none;position:fixed;inset:0px;top:0;left:0;width:100%;height:100%;z-index:20000}.message-box-bg{position:absolute;background:#fff;border-radius:10px;padding:20px;top:50%;left:50%;transform:translate(-50%,-50%);width:500px;z-index:20001}.message-box-mark{width:100%;height:100%;position:fixed;top:0;left:0;background:rgba(0,0,0,.5);z-index:20000}.message-box-btn{text-align:right}.message-box-btn button{margin:0 5px;width:120px;height:40px;border-width:0;border-radius:3px;background:#1e90ff;cursor:pointer;outline:0;color:#fff;font-size:17px}.message-box-btn button:hover{background:#59f}</style> '; function messageBox(ctx, type) { "confirm" === type ? $('.message-box-btn button[name="cancel"]').show() : "alert" === type && $('.message-box-btn button[name="cancel"]').hide(), ctx.html ? $("#message_box_context").html('<div style="font-size:18px">'.concat(ctx.html, "</div>")) : $("#message_box_context").html('<div style="font-size:18px">╰( ̄▽ ̄)╮</div>'), "confirm" === type ? $('.message-box-btn button[name="cancel"]').show() : "alert" === type && $('.message-box-btn button[name="cancel"]').hide(), ctx.html ? $("#message_box_context").html('<div style="font-size:18px">'.concat(ctx.html, "</div>")) : $("#message_box_context").html('<div style="font-size:18px">╰( ̄▽ ̄)╮</div>'), scroll_scroll.hide(), $("#message_box").show(), $("#message_box").animate({ opacity: "1" }, 300); var option = { affirm: function affirm() { $("#message_box").hide(), $("#message_box").css("opacity", 0), scroll_scroll.show(), $("#message_box").hide(), $("#message_box").css("opacity", 0), scroll_scroll.show(), ctx.callback && ctx.callback.affirm && ctx.callback.affirm(); }, cancel: function cancel() { $("#message_box").hide(), $("#message_box").css("opacity", 0), scroll_scroll.show(), $("#message_box").hide(), $("#message_box").css("opacity", 0), scroll_scroll.show(), ctx.callback && ctx.callback.cancel && ctx.callback.cancel(); } }; return $('.message-box-btn button[name="affirm"]')[0].onclick = option.affirm, $('.message-box-btn button[name="cancel"]')[0].onclick = option.cancel, return $('.message-box-btn button[name="affirm"]')[0].onclick = option.affirm, $('.message-box-btn button[name="cancel"]')[0].onclick = option.cancel, option; } var id = 0; function message_message(html, type) { console.info("[Message] ".concat(type, " : ").concat(html)), function messageEnQueue(message, id) { $(".message-bg").append(message), $("#message_".concat(id)).animate({ "margin-top": "+=70px", opacity: "1" }, 300); }('<div id="message_'.concat(id += 1, '" class="message message-').concat(type, '"><div class="message-context"><p><strong>').concat(type, ":</strong></p><p>").concat(html, "</p></div></div>"), id), }('<div id="message_'.concat(id += 1, '" class="message message-').concat(type, '"><div class="message-context"><p><strong>').concat(type, ":</strong></p><p>").concat(html, "</p></div></div>"), id), function messageDeQueue(id) { var time = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 3; setTimeout(function() { var e = "div#message_".concat(id);34 行未改动 }; function ajax(obj) { return new Promise(function(resolve, reject) { obj.success = function(res) { res && res.code && message_Message_warning("".concat(res.message || "CODE:".concat(res.code))), res && res.code && message_Message_warning("".concat(res.message || "CODE:".concat(res.code))), resolve(res); }, obj.error = function(err) { message_Message_error("网络异常"), reject(err); }, $.ajax(obj);179 行未改动全部展开 } function video_base_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, video_base_toPropertyKey(o.key), o); } } function video_base_createClass(e, r, t) { return r && video_base_defineProperties(e.prototype, r), t && video_base_defineProperties(e, t), return r && video_base_defineProperties(e.prototype, r), t && video_base_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }11 行未改动 return "symbol" == video_base_typeof(i) ? i : i + ""; } var clazzMap = {}, VideoBase = function() { function VideoBase(video_type, main_title, state) { video_base_classCallCheck(this, VideoBase), this.constructor.name in clazzMap || (clazzMap[this.constructor.name] = this.constructor), this.video_type = video_type || "video", this.main_title = main_title || "", this.state = state, video_base_classCallCheck(this, VideoBase), this.constructor.name in clazzMap || (clazzMap[this.constructor.name] = this.constructor), this.video_type = video_type || "video", this.main_title = main_title || "", this.state = state, this.page = state && parseInt(state.p) || 1; } return video_base_createClass(VideoBase, [ { key: "getVideo",97 行未改动 _inherits(Video, _VideoBase); var _super = _createSuper(Video); function Video(main_title, state) { var _state$sectionsInfo, _this2; video_base_classCallCheck(this, Video), (_this2 = _super.call(this, "video", main_title, state)).video_list = [], video_base_classCallCheck(this, Video), (_this2 = _super.call(this, "video", main_title, state)).video_list = [], _this2.epList = []; var sections = state.sections || (null === (_state$sectionsInfo = state.sectionsInfo) || void 0 === _state$sectionsInfo ? void 0 : _state$sectionsInfo.sections) || []; if (!sections.length) return _possibleConstructorReturn(_this2); var _step, _iterator = _createForOfIteratorHelper(sections);3 行未改动 try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { for (var video = _step2.value, i = 0, length = video.pages && video.pages.length || 0; i < length; ) { var _video = Object.assign({}, video); _video.title = video.title + (length > 1 ? " P".concat(i + 1, " ").concat(video.pages[i].part) : ""), _video.title = video.title + (length > 1 ? " P".concat(i + 1, " ").concat(video.pages[i].part) : ""), _video.cid = video.pages[i].cid || 0, _this2.video_list.push(_video), i++; } _this2.epList.push(video); }57 行未改动 var _step3, video_list = [], _iterator3 = _createForOfIteratorHelper(state.resourceList || []); try { for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) for (var video = _step3.value, i = 0, length = video.pages && video.pages.length || 0; i < length; ) { var _video = Object.assign({}, video); _video.title = video.title + (length > 1 ? " P".concat(i + 1, " ").concat(video.pages[i].title) : ""), _video.title = video.title + (length > 1 ? " P".concat(i + 1, " ").concat(video.pages[i].title) : ""), _video.cid = video.pages[i].cid || 0, video_list.push(_video), i++; } } catch (err) { _iterator3.e(err);44 行未改动 _inherits(VideoFestival, _VideoBase3); var _super3 = _createSuper(VideoFestival); function VideoFestival(main_title, state) { var _this4; return video_base_classCallCheck(this, VideoFestival), (_this4 = _super3.call(this, "video", main_title, state)).video_info = state.videoInfo, return video_base_classCallCheck(this, VideoFestival), (_this4 = _super3.call(this, "video", main_title, state)).video_info = state.videoInfo, _this4.video_list = state.sectionEpisodes || [], _this4; } return video_base_createClass(VideoFestival, [ { key: "total",35 行未改动 _inherits(Bangumi, _VideoBase4); var _super4 = _createSuper(Bangumi); function Bangumi(main_title, state) { var _this5; return video_base_classCallCheck(this, Bangumi), (_this5 = _super4.call(this, "bangumi", main_title, state)).epInfo = state.epInfo, _this5.epList = state.epList, _this5.epId = state.epId, _this5.epMap = state.epMap, return video_base_classCallCheck(this, Bangumi), (_this5 = _super4.call(this, "bangumi", main_title, state)).epInfo = state.epInfo, _this5.epList = state.epList, _this5.epId = state.epId, _this5.epMap = state.epMap, _this5.isEpMap = state.isEpMap, _this5; } return video_base_createClass(Bangumi, [ { key: "total",7 行未改动 } }, { key: "getEpPadLen", value: function getEpPadLen() { for (var n = Object.keys(this.isEpMap).length, len = n < 10 ? 1 : 0; n >= 1; ) n /= 10, for (var n = Object.keys(this.isEpMap).length, len = n < 10 ? 1 : 0; n >= 1; ) n /= 10, len++; return len; } }, {55 行未改动 var bangumiCache = cache.get("Bangumi"); if (location.href == bangumiCache.get("href") && bangumiCache.get("build")) return bangumiCache.get("build"); bangumiCache.set("build", null); var main_title, sid, epid, epMap = {}, pathname = location.pathname.toLowerCase(); pathname.startsWith("/bangumi/play/ss") ? (sid = pathname.match(/ss(\d+)/), sid = parseInt(sid[1])) : pathname.startsWith("/bangumi/play/ep") && (epid = pathname.match(/ep(\d+)/), pathname.startsWith("/bangumi/play/ss") ? (sid = pathname.match(/ss(\d+)/), sid = parseInt(sid[1])) : pathname.startsWith("/bangumi/play/ep") && (epid = pathname.match(/ep(\d+)/), epid = parseInt(epid[1])); try { console.log("location sid:", sid, "epid:", epid); var page_data = JSON.parse($(".toolbar").attr("mr-show")); main_title = page_data.msg.title, sid = sid || page_data.msg.season_id, epid = epid || page_data.msg.ep_id, main_title = page_data.msg.title, sid = sid || page_data.msg.season_id, epid = epid || page_data.msg.ep_id, console.log("mr-show get sid:", sid, "epid:", epid); } catch (_unused) { console.warn("mr-show get err"); } if (sid != bangumiCache.get("sid") && (bangumiCache.set("sid", sid), bangumiCache.set("epid", ""), if (sid != bangumiCache.get("sid") && (bangumiCache.set("sid", sid), bangumiCache.set("epid", ""), bangumiCache.set("hasData", !1)), sid && !epid && _ajax({ type: "GET", url: "https://api.bilibili.com/pgc/player/web/v2/playurl?support_multi_audio=true&qn=80&fnver=0&fnval=4048&fourk=1&gaia_source=&from_client=BROWSER&is_main_page=true&need_fragment=true&season_id=".concat(sid, "&isGaiaAvoided=false&voice_balance=1&drm_tech_type=2"), dataType: "json",8 行未改动 url: "https://api.bilibili.com/pgc/view/web/ep/list?season_id=".concat(sid = sid || "", "&ep_id=").concat(epid), dataType: "json", cache: !0 }).then(function(res) { res && !res.code && (bangumiCache.set("hasData", !0), bangumiCache.set("episodes", res.result.episodes || []), res && !res.code && (bangumiCache.set("hasData", !0), bangumiCache.set("episodes", res.result.episodes || []), bangumiCache.set("section", res.result.section || [])); }).finally(function() { bangumiCache.set("lock", !1); }), bangumiCache.set("href", location.href), !epid && !bangumiCache.get("epid")) throw "epid not found !";36 行未改动 } finally { _iterator5.f(); } epid = epid || bangumiCache.get("epid"); for (var _id = 0, i = 0; i < episodes.length; i++) epMap[episodes[i].id] = episodes[i], for (var _id = 0, i = 0; i < episodes.length; i++) epMap[episodes[i].id] = episodes[i], episodes[i].id == epid && (_id = i); var bangumi = new Bangumi(main_title, { p: _id + 1, epId: epid,9 行未改动 _inherits(Cheese, _VideoBase5); var _super5 = _createSuper(Cheese); function Cheese(main_title, state) { var _this6; return video_base_classCallCheck(this, Cheese), (_this6 = _super5.call(this, "cheese", main_title, state)).episodes = state.episodes, return video_base_classCallCheck(this, Cheese), (_this6 = _super5.call(this, "cheese", main_title, state)).episodes = state.episodes, _this6; } return video_base_createClass(Cheese, [ { key: "total",28 行未改动 } ], [ { key: "build", value: function build() { var epid, cheeseCache = cache.get("Cheese"), sid = (location.href.match(/\/cheese\/play\/ss(\d+)/i) || [ "", "" ])[1]; if (sid || (epid = (location.href.match(/\/cheese\/play\/ep(\d+)/i) || [ "", "" ])[1]), epid || (epid = parseInt($(".bpx-state-active").eq(0).attr("data-episodeid"))), sid && sid != cheeseCache.get("sid") && (cheeseCache.set("sid", sid), cheeseCache.set("episodes", null)), if (sid || (epid = (location.href.match(/\/cheese\/play\/ep(\d+)/i) || [ "", "" ])[1]), epid || (epid = parseInt($(".bpx-state-active").eq(0).attr("data-episodeid"))), sid && sid != cheeseCache.get("sid") && (cheeseCache.set("sid", sid), cheeseCache.set("episodes", null)), !cheeseCache.get("episodes")) { if (cheeseCache.get("lock")) throw "cheese request waiting !"; if (cheeseCache.set("lock", !0), !sid && !epid) return void console.log("get_season error"); _ajax({77 行未改动 } else { var keys = Object.keys(videoQualityMap), _q2 = parseInt(("video" === _type ? $("li.bpx-player-ctrl-quality-menu-item.bpx-state-active") : $("li.squirtle-select-item.active")).attr("data-value")), _q_max2 = parseInt($(("video" === _type ? $("li.bpx-player-ctrl-quality-menu-item") : $("li.squirtle-select-item")).get(0)).attr("data-value")); _q = keys.indexOf("".concat(_q2)) > -1 ? _q2 : 0, _q_max = keys.indexOf("".concat(_q_max2)) > -1 ? _q_max2 : 0; } return _q || (_q = parseInt($("li.bpx-player-ctrl-quality-menu-item.bpx-state-active").attr("data-value") || _q)), _q_max || (_q_max = parseInt($("li.bpx-player-ctrl-quality-menu-item").attr("data-value") || _q_max)), !_q_max && (_q_max = 80) && console.error("video get quality max error"), !_q && (_q = _q_max < 80 ? _q_max : 80), return _q || (_q = parseInt($("li.bpx-player-ctrl-quality-menu-item.bpx-state-active").attr("data-value") || _q)), _q_max || (_q_max = parseInt($("li.bpx-player-ctrl-quality-menu-item").attr("data-value") || _q_max)), !_q_max && (_q_max = 80) && console.error("video get quality max error"), !_q && (_q = _q_max < 80 ? _q_max : 80), user.isVIP() || (_q = _q > 80 ? 80 : _q), { q: _q, q_max: _q_max };4 行未改动 var k = $(this).text(); q_map[k] && quality_list.push(q_map[k]); }); else { var keys = Object.keys(videoQualityMap); (list = [ "video", "list" ].includes(_type) ? $("li.bpx-player-ctrl-quality-menu-item") : $("li.squirtle-select-item"))[0] || (list = $("li.bpx-player-ctrl-quality-menu-item")), (list = [ "video", "list" ].includes(_type) ? $("li.bpx-player-ctrl-quality-menu-item") : $("li.squirtle-select-item"))[0] || (list = $("li.bpx-player-ctrl-quality-menu-item")), list && list.length && list.each(function() { var q = "".concat(parseInt($(this).attr("data-value"))); keys.indexOf(q) > -1 && quality_list.push(q); });10 行未改动 } function store_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, store_toPropertyKey(o.key), o); } } function store_toPropertyKey(t) {15 行未改动 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }(this, Store), this.prefix = "bp_"; } return function store_createClass(e, r, t) { return r && store_defineProperties(e.prototype, r), t && store_defineProperties(e, t), return r && store_defineProperties(e.prototype, r), t && store_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }(Store, [ {120 行未改动全部展开 return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally {99 行未改动 }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n;7 行未改动 if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) {17 行未改动 var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function() { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function() { return this; }), _regeneratorDefine2(u, "toString", function() { return "[object Generator]";51 行未改动 "auto" === request_type && user.needReplace() && (request_type = "remote"); var base_api, url_replace_cdn = function url_replace_cdn(url) { if ("0" === config_config.host_key) return url; var url_tmp = url.split("/"), mapping = hostMap[config_config.host_key]; return "string" == typeof mapping && mapping.length ? mapping.at(0).match(/[a-z]/) && (url_tmp[2] = mapping) : "function" == typeof mapping && (url_tmp[2] = mapping()), return "string" == typeof mapping && mapping.length ? mapping.at(0).match(/[a-z]/) && (url_tmp[2] = mapping) : "function" == typeof mapping && (url_tmp[2] = mapping()), url = url_tmp.join("/"); }, ajax_obj = { type: "GET", dataType: "json" }; if ("auto" === request_type || "local" === request_type) { var fnver, fnval; "cheese" === type ? (base_api = "https://api.bilibili.com/pugv/player/web/playurl", fnver = "mp4" === format ? 1 : 0, fnval = 80) : (base_api = "video" === type ? "https://api.bilibili.com/x/player/playurl" : "https://api.bilibili.com/pgc/player/web/playurl", "cheese" === type ? (base_api = "https://api.bilibili.com/pugv/player/web/playurl", fnver = "mp4" === format ? 1 : 0, fnval = 80) : (base_api = "video" === type ? "https://api.bilibili.com/x/player/playurl" : "https://api.bilibili.com/pgc/player/web/playurl", fnver = 0, fnval = { dash: 4048, flv: 4049, mp4: 0 }[format] || 0), base_api += "?avid=".concat(aid, "&bvid=").concat(bvid, "&cid=").concat(cid, "&qn=").concat(q, "&fnver=").concat(fnver, "&fnval=").concat(fnval, "&fourk=1&ep_id=").concat(epid, "&type=").concat(format, "&otype=json"), }[format] || 0), base_api += "?avid=".concat(aid, "&bvid=").concat(bvid, "&cid=").concat(cid, "&qn=").concat(q, "&fnver=").concat(fnver, "&fnval=").concat(fnval, "&fourk=1&ep_id=").concat(epid, "&type=").concat(format, "&otype=json"), base_api += "mp4" === format ? "&platform=html5&high_quality=1" : "", ajax_obj.xhrFields = { withCredentials: !0 }; } else { base_api = config_config.base_api, base_api += "?av=".concat(aid, "&bv=").concat(bvid, "&cid=").concat(cid, "&ep=").concat(epid, "&q=").concat(q, "&type=").concat(type, "&format=").concat(format, "&otype=json"), base_api = config_config.base_api, base_api += "?av=".concat(aid, "&bv=").concat(bvid, "&cid=").concat(cid, "&ep=").concat(epid, "&q=").concat(q, "&type=").concat(type, "&format=").concat(format, "&otype=json"), page && (base_api += "&s"); var _ref2 = [ store.get("auth_id"), store.get("auth_sec") ], auth_id = _ref2[0], auth_sec = _ref2[1]; auth_id && auth_sec && (base_api += "&auth_id=".concat(auth_id, "&auth_sec=").concat(auth_sec)); }13 行未改动 }) : Promise.resolve(key); }; new Promise(function(resolve, reject) { var promiseList = [], valueList = []; data.url ? promiseList.push(checkTask("url", "backup_url")) : (promiseList.push(checkTask("video", "backup_video")), data.url ? promiseList.push(checkTask("url", "backup_url")) : (promiseList.push(checkTask("video", "backup_video")), promiseList.push(checkTask("audio", "backup_audio"))); var timer = setTimeout(function() { resolve(valueList); }, 1500), index = 0;26 行未改动 case 6: _context.prev = 6, _context.t0 = _context.catch(0), result = _context.t0;
case 9: console.log("use " + result), valueList[index++] = result, index == promiseList.length && (clearInterval(timer), console.log("use " + result), valueList[index++] = result, index == promiseList.length && (clearInterval(timer), resolve(valueList));
case 12: case "end":24 行未改动 }); }; ajax_obj.url = base_api, ajax(ajax_obj).then(function(res) { var data; if (res.code || (data = res.result || res.data), !data) return "auto" === request_type ? void get_url_base(page, quality, video_format, success, error, "remote") : (res.url && (res.url = url_replace_cdn(res.url)), res.video && (res.video = url_replace_cdn(res.video)), res.audio && (res.audio = url_replace_cdn(res.audio)), if (res.code || (data = res.result || res.data), !data) return "auto" === request_type ? void get_url_base(page, quality, video_format, success, error, "remote") : (res.url && (res.url = url_replace_cdn(res.url)), res.video && (res.video = url_replace_cdn(res.video)), res.audio && (res.audio = url_replace_cdn(res.audio)), void resultConvertor(res, _success)); if (data.dash) { for (var result = { code: 0,3 行未改动 audio: "" }, videos = data.dash.video, i = 0; i < videos.length; i++) { var _video = videos[i]; if (_video.id <= q) { result.video = url_replace_cdn(_video.base_url), result.audio = url_replace_cdn(data.dash.audio[0].base_url), result.backup_video = _video.backup_url && url_replace_cdn(_video.backup_url[0]), result.video = url_replace_cdn(_video.base_url), result.audio = url_replace_cdn(data.dash.audio[0].base_url), result.backup_video = _video.backup_url && url_replace_cdn(_video.backup_url[0]), result.backup_audio = data.dash.audio[0].backup_url && url_replace_cdn(data.dash.audio[0].backup_url[0]); break; } }102 行未改动全部展开 return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally {70 行未改动 f(t); } } var r; this.next || (runtime_lib_regeneratorDefine2(runtime_lib_regeneratorAsyncIterator.prototype), this.next || (runtime_lib_regeneratorDefine2(runtime_lib_regeneratorAsyncIterator.prototype), runtime_lib_regeneratorDefine2(runtime_lib_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() { return this; })), runtime_lib_regeneratorDefine2(this, "_invoke", function(t, o, i) { function f() {21 行未改动 }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n;7 行未改动 if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) {17 行未改动 var c = [][n] ? t(t([][n]())) : (runtime_lib_regeneratorDefine2(t = {}, n, function() { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, runtime_lib_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, runtime_lib_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, runtime_lib_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), runtime_lib_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", runtime_lib_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), runtime_lib_regeneratorDefine2(u), runtime_lib_regeneratorDefine2(u, o, "Generator"), return GeneratorFunction.prototype = GeneratorFunctionPrototype, runtime_lib_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), runtime_lib_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", runtime_lib_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), runtime_lib_regeneratorDefine2(u), runtime_lib_regeneratorDefine2(u, o, "Generator"), runtime_lib_regeneratorDefine2(u, n, function() { return this; }), runtime_lib_regeneratorDefine2(u, "toString", function() { return "[object Generator]";53 行未改动 } function runtime_lib_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, runtime_lib_toPropertyKey(o.key), o); } } function runtime_lib_toPropertyKey(t) {15 行未改动 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }(this, RuntimeLib), this.config = config, this.moduleAsync, this.anyResolved = !1; } return function runtime_lib_createClass(e, r, t) { return r && runtime_lib_defineProperties(e.prototype, r), t && runtime_lib_defineProperties(e, t), return r && runtime_lib_defineProperties(e.prototype, r), t && runtime_lib_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }(RuntimeLib, [ { key: "getModulePromise", value: function getModulePromise() { var _this = this, _this$config = this.config, urls = _this$config.urls, errs = (_this$config.getModule, var _this = this, _this$config = this.config, urls = _this$config.urls, errs = (_this$config.getModule, []); return urls && urls.length ? new Promise(function(resolve, reject) { var i = 0; urls.forEach(function(url) {8 行未改动 } return _context.abrupt("return");
case 3: return console.log("[Runtime Library] Start download from ".concat(url)), _context.next = 6, return console.log("[Runtime Library] Start download from ".concat(url)), _context.next = 6, _ajax({ url: url, type: "GET", dataType: "text",7 行未改动 } return _context.abrupt("return");
case 9: console.log("[Runtime Library] Downloaded from ".concat(url, " , length = ").concat(code.length)), console.log("[Runtime Library] Downloaded from ".concat(url, " , length = ").concat(code.length)), _this.anyResolved = !0, resolve(code), _context.next = 20; break;
case 14:78 行未改动
case 6: _context2.t1 = _context2.sent, _context2.t2 = [ _context2.t1 ], _context2.t3 = { type: "text/javascript" }, blob = new _context2.t0(_context2.t2, _context2.t3), blob_url = URL.createObjectURL(blob), }, blob = new _context2.t0(_context2.t2, _context2.t3), blob_url = URL.createObjectURL(blob), (script_tag = document.createElement("script")).src = blob_url, script_tag.onload = function() { console.log("[Runtime Library] Loaded ".concat(name, " from local")), getModule(window), console.log("[Runtime Library] Loaded ".concat(name, " from local")), getModule(window), URL.revokeObjectURL(blob_url); }, script_tag.onerror = function() { console.error("[Runtime Library] Failed to load ".concat(name, " from local")), console.error("[Runtime Library] Failed to load ".concat(name, " from local")), URL.revokeObjectURL(blob_url); }, runtime_div.appendChild(script_tag);
case 16:18 行未改动 } function recover_player() { if (window.bp_dplayer) { var bili_video = $(bili_video_tag())[0]; bili_video && bili_video.removeEventListener("play", bili_video_stop, !1), window.bp_dplayer.destroy(), window.bp_dplayer = null, $("#bp_dplayer").remove(), window.bp_dplayer_2 && (window.bp_dplayer_2.destroy(), bili_video && bili_video.removeEventListener("play", bili_video_stop, !1), window.bp_dplayer.destroy(), window.bp_dplayer = null, $("#bp_dplayer").remove(), window.bp_dplayer_2 && (window.bp_dplayer_2.destroy(), window.bp_dplayer_2 = null, $("#bp_dplayer_2").remove()), $(get_bili_player_id()).show(); } } function danmaku_config() {24 行未改动 recover_player(); var bili_video = $(bili_video_tag())[0]; bili_video_stop(), bili_video && bili_video.addEventListener("play", bili_video_stop, !1); var bili_player_id = get_bili_player_id(); $("#bilibiliPlayer")[0] ? ($(bili_player_id).before('<div id="bp_dplayer" class="bilibili-player relative bilibili-player-no-cursor">'), $(bili_player_id).hide()) : $("#bilibili-player")[0] ? ($(bili_player_id).before('<div id="bp_dplayer" class="bilibili-player relative bilibili-player-no-cursor" style="width:100%;height:100%;z-index:1000;"></div>'), $(bili_player_id).hide()) : $("#edu-player")[0] ? ($(bili_player_id).before('<div id="bp_dplayer" style="width:100%;height:100%;z-index:1000;"></div>'), $("#bilibiliPlayer")[0] ? ($(bili_player_id).before('<div id="bp_dplayer" class="bilibili-player relative bilibili-player-no-cursor">'), $(bili_player_id).hide()) : $("#bilibili-player")[0] ? ($(bili_player_id).before('<div id="bp_dplayer" class="bilibili-player relative bilibili-player-no-cursor" style="width:100%;height:100%;z-index:1000;"></div>'), $(bili_player_id).hide()) : $("#edu-player")[0] ? ($(bili_player_id).before('<div id="bp_dplayer" style="width:100%;height:100%;z-index:1000;"></div>'), $(bili_player_id).hide()) : MessageBox_alert('<div id="bp_dplayer" style="width:100%;height:100%;"></div>', function() { recover_player(); }), api.get_subtitle_url(0, function dplayer_init() { var subtitle_url = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "";75 行未改动 !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(), 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() {21 行未改动 } function check_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, check_toPropertyKey(o.key), o); } } function check_toPropertyKey(t) {12 行未改动 var check = new (function() { function Check() { !function check_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }(this, Check), this.href = "", this.aid = "", this.cid = "", this.q = "", this.epid = "", }(this, Check), this.href = "", this.aid = "", this.cid = "", this.q = "", this.epid = "", this.locked = !1; } return function check_createClass(e, r, t) { return r && check_defineProperties(e.prototype, r), t && check_defineProperties(e, t), return r && check_defineProperties(e.prototype, r), t && check_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }(Check, [ { key: "refresh", value: function refresh() { if (!this.locked) { this.locked = !0, console.log("refresh..."), $("#video_download").hide(), $("#video_download_2").hide(), this.locked = !0, console.log("refresh..."), $("#video_download").hide(), $("#video_download_2").hide(), player.recover_player(); try { this.href = location.href; var vb = video.base();51 行未改动 return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally {70 行未改动 f(t); } } var r; this.next || (common_regeneratorDefine2(common_regeneratorAsyncIterator.prototype), this.next || (common_regeneratorDefine2(common_regeneratorAsyncIterator.prototype), common_regeneratorDefine2(common_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() { return this; })), common_regeneratorDefine2(this, "_invoke", function(t, o, i) { function f() {21 行未改动 }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n;7 行未改动 if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) {17 行未改动 var c = [][n] ? t(t([][n]())) : (common_regeneratorDefine2(t = {}, n, function() { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, common_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, common_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, common_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), common_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", common_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), return GeneratorFunction.prototype = GeneratorFunctionPrototype, common_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), common_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", common_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), common_regeneratorDefine2(u), common_regeneratorDefine2(u, o, "Generator"), common_regeneratorDefine2(u, n, function() { return this; }), common_regeneratorDefine2(u, "toString", function() { return "[object Generator]";145 行未改动全部展开 if ((response = _context.sent).ok) { _context.next = 8; break; } throw errorMsg = "toBlobURL: Failed to fetch ".concat(url, ": ").concat(response.status, " ").concat(response.statusText), throw errorMsg = "toBlobURL: Failed to fetch ".concat(url, ": ").concat(response.status, " ").concat(response.statusText), console.error(errorMsg), new Error(errorMsg);
case 8: return _context.next = 10, response.arrayBuffer();
case 10: return buffer = _context.sent, blob = new Blob([ buffer ], { type: mimeType }), blobUrl = URL.createObjectURL(blob), console.log("toBlobURL: Created Blob URL for ".concat(url)), }), blobUrl = URL.createObjectURL(blob), console.log("toBlobURL: Created Blob URL for ".concat(url)), _context.abrupt("return", blobUrl);
case 15: case "end":3 行未改动 }))).apply(this, arguments); } function downloadBlobURL(blobUrl, downloadname) { var a = document.createElement("a"); a.href = blobUrl, a.download = downloadname, a.style.display = "none", document.body.appendChild(a), a.href = blobUrl, a.download = downloadname, a.style.display = "none", document.body.appendChild(a), a.click(), document.body.removeChild(a), setTimeout(function() { return URL.revokeObjectURL(blobUrl); }, 100); }20 行未改动 } throw new Error("URL下载失败: " + url);
case 6: contentLength = res.headers.get("content-length"), total = contentLength ? parseInt(contentLength, 10) : 0, contentLength = res.headers.get("content-length"), total = contentLength ? parseInt(contentLength, 10) : 0, reader = res.body.getReader(), loaded = 0, chunks = [];
case 11: return _context3.next = 14, reader.read();
case 14: if (_yield$reader$read = _context3.sent, done = _yield$reader$read.done, (value = _yield$reader$read.value) && (chunks.push(value), if (_yield$reader$read = _context3.sent, done = _yield$reader$read.done, (value = _yield$reader$read.value) && (chunks.push(value), loaded += value.length, onProgress && onProgress(loaded, total)), !done) { _context3.next = 20; break; }3 行未改动 _context3.next = 11; break;
case 22: for (dataArray = new Uint8Array(loaded), pos = 0, _i = 0, _chunks = chunks; _i < _chunks.length; _i++) chunk = _chunks[_i], for (dataArray = new Uint8Array(loaded), pos = 0, _i = 0, _chunks = chunks; _i < _chunks.length; _i++) chunk = _chunks[_i], dataArray.set(chunk, pos), pos += chunk.length; return _context3.abrupt("return", dataArray);
case 26:5 行未改动 } function prettyBytes(bytes) { var decimalPlaces = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2; if (0 === bytes) return "0 B"; for (var units = [ "B", "KB", "MB", "GB", "TB" ], size = bytes, unitIndex = 0; size >= 1024 && unitIndex < units.length - 1; ) size /= 1024, for (var units = [ "B", "KB", "MB", "GB", "TB" ], size = bytes, unitIndex = 0; size >= 1024 && unitIndex < units.length - 1; ) size /= 1024, unitIndex++; var formatted = size.toFixed(decimalPlaces); return "".concat(formatted, " ").concat(units[unitIndex]); }88 行未改动 return r(_t, o); } finally { e.next = n.n; } }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n; try { return r.call(this, e); } finally {70 行未改动 f(t); } } var r; this.next || (ffmpeg_regeneratorDefine2(ffmpeg_regeneratorAsyncIterator.prototype), this.next || (ffmpeg_regeneratorDefine2(ffmpeg_regeneratorAsyncIterator.prototype), ffmpeg_regeneratorDefine2(ffmpeg_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function() { return this; })), ffmpeg_regeneratorDefine2(this, "_invoke", function(t, o, i) { function f() {21 行未改动 }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n;7 行未改动 if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) {17 行未改动 var c = [][n] ? t(t([][n]())) : (ffmpeg_regeneratorDefine2(t = {}, n, function() { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, ffmpeg_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, ffmpeg_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, ffmpeg_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), ffmpeg_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", ffmpeg_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), return GeneratorFunction.prototype = GeneratorFunctionPrototype, ffmpeg_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), ffmpeg_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", ffmpeg_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), ffmpeg_regeneratorDefine2(u), ffmpeg_regeneratorDefine2(u, o, "Generator"), ffmpeg_regeneratorDefine2(u, n, function() { return this; }), ffmpeg_regeneratorDefine2(u, "toString", function() { return "[object Generator]";80 行未改动 var baseFFmpegUrl, baseCoreUrl, baseCoreMTUrl; return ffmpeg_regeneratorRuntime().wrap(function _callee$(_context) { for (;;) switch (_context.prev = _context.next) { case 0: if (baseFFmpegUrl = "https://unpkg.com/@ffmpeg/ffmpeg@0.12.15/dist/umd", baseCoreUrl = "https://unpkg.com/@ffmpeg/core@0.12.10/dist/umd", if (baseFFmpegUrl = "https://unpkg.com/@ffmpeg/ffmpeg@0.12.15/dist/umd", baseCoreUrl = "https://unpkg.com/@ffmpeg/core@0.12.10/dist/umd", baseCoreMTUrl = "https://unpkg.com/@ffmpeg/core-mt@0.12.10/dist/umd", ffmpeg.on("log", function(_ref3) { var message = _ref3.message; console.log("[ffmpeg]", message); }), !window.crossOriginIsolated) { _context.next = 25; break; } return console.log("[ffmpeg] 多线程模式"), _context.t0 = ffmpeg, _context.next = 10, return console.log("[ffmpeg] 多线程模式"), _context.t0 = ffmpeg, _context.next = 10, toBlobURL("".concat(baseCoreMTUrl, "/ffmpeg-core.js"), "text/javascript");
case 10: return _context.t1 = _context.sent, _context.next = 13, toBlobURL("".concat(baseCoreMTUrl, "/ffmpeg-core.wasm"), "application/wasm");16 行未改动 _context.next = 39; break;
case 25: return console.log("[ffmpeg] 单线程模式"), _context.t6 = ffmpeg, _context.next = 29, return console.log("[ffmpeg] 单线程模式"), _context.t6 = ffmpeg, _context.next = 29, toBlobURL("".concat(baseCoreUrl, "/ffmpeg-core.js"), "text/javascript");
case 29: return _context.t7 = _context.sent, _context.next = 32, toBlobURL("".concat(baseCoreUrl, "/ffmpeg-core.wasm"), "application/wasm");39 行未改动 signal: controller.signal }) ]);
case 20: return _yield$Promise$all = _context2.sent, _yield$Promise$all2 = ffmpeg_slicedToArray(_yield$Promise$all, 2), videoData = _yield$Promise$all2[0], audioData = _yield$Promise$all2[1], _context2.next = 26, return _yield$Promise$all = _context2.sent, _yield$Promise$all2 = ffmpeg_slicedToArray(_yield$Promise$all, 2), videoData = _yield$Promise$all2[0], audioData = _yield$Promise$all2[1], _context2.next = 26, ffmpeg.writeFile("video.m4s", videoData);
case 26: return _context2.next = 28, ffmpeg.writeFile("audio.m4s", audioData);13 行未改动 type: "video/mp4" })));
case 38: return _context2.prev = 38, _context2.t0 = _context2.catch(11), controller && controller.signal && !controller.signal.aborted && (controller.abort(), message_Message_error("任务被迫中止")), console.error("Error merging streams:", _context2.t0), return _context2.prev = 38, _context2.t0 = _context2.catch(11), controller && controller.signal && !controller.signal.aborted && (controller.abort(), message_Message_error("任务被迫中止")), console.error("Error merging streams:", _context2.t0), _context2.abrupt("return", Promise.reject(_context2.t0));
case 43: case "end":90 行未改动 var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0, videos = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : []; if (video_tasks.length) { if (i >= video_tasks.length) { var type = rpc_type(); return videos.length > 0 && (download_videos_rpc(videos, type), videos.length = 0), return videos.length > 0 && (download_videos_rpc(videos, type), videos.length = 0), void MessageBox_alert("批量下载执行结束!"); } var task = video_tasks[i], msg = "第".concat(i + 1, "(").concat(i + 1, "/").concat(video_tasks.length, ")个视频"); MessageBox_alert("".concat(msg, ":获取中...")); api.get_urls(task.p, task.q, task.format, function success(res) { if (setTimeout(function() { download_videos(video_tasks, i + 1, videos); }, 4e3), !res.code) { message_Message_success("请求成功" + (res.times ? "<br/>今日剩余请求次数".concat(res.times) : "")), message_Message_success("请求成功" + (res.times ? "<br/>今日剩余请求次数".concat(res.times) : "")), MessageBox_alert("".concat(msg, ":获取成功!")); var _ref3 = [ res.url, rpc_type(), res.video, res.audio ], url = _ref3[0], type = _ref3[1], video_url = _ref3[2], audio_url = _ref3[3]; "dash" === task.format ? (task.dl_video && videos.push({ url: video_url,6 行未改动 })) : videos.push({ url: url, filename: task.filename + format(url), rpc_dir: task.rpc_dir }), "post" === type ? videos.length > 3 && (download_videos_rpc(videos, type), videos.length = 0) : "ariang" === type && (download_videos_rpc(videos, type), }), "post" === type ? videos.length > 3 && (download_videos_rpc(videos, type), videos.length = 0) : "ariang" === type && (download_videos_rpc(videos, type), videos.length = 0); } }, function error() { download_videos(video_tasks, i + 1, videos);43 行未改动 }(), message_Message_success("已连接到 Motrix,任务已发送")); }); }, 500); } if ("1" === config_config.show_motrix_confirm_open_auto) return window.open("motrix://"), if ("1" === config_config.show_motrix_confirm_open_auto) return window.open("motrix://"), void startPolling(); MessageBox_confirm("未检测到运行的 Motrix,是否启动?", function() { window.open("motrix://"), startPolling(); }, function() {68 行未改动 bp_aria2_window && !bp_aria2_window.closed || (open_ariang(), time = 3e3), setTimeout(function() { var bp_aria2_window = window.bp_aria2_window, cmd = [ "url=".concat(encodeURIComponent(window.btoa(video.url))), "out=".concat(encodeURIComponent(video.filename)), "header=User-Agent:".concat(window.navigator.userAgent), "header=Referer:".concat(window.location.origin) ]; (video.rpc_dir || config_config.ariang_dir) && cmd.push("dir=".concat(encodeURIComponent(video.rpc_dir || config_config.ariang_dir))); var task_hash = "#!/new/task?" + cmd.join("&"); bp_aria2_window && !bp_aria2_window.closed ? (bp_aria2_window.location.href = config_config.ariang_host + task_hash, bp_aria2_window && !bp_aria2_window.closed ? (bp_aria2_window.location.href = config_config.ariang_host + task_hash, message_Message_success("发送RPC请求")) : message_Message_warning("AriaNg页面未打开"); }, time); }(videos.pop()), setTimeout(function() { download_rpc_ariang.apply(void 0, videos);144 行未改动全部展开 } var _document$head$innerH, Download = { url_format: format, download: function download(url, filename, type) { filename = filename.replace(/[\/\\*|]+/g, "-").replace(/:/g, ":").replace(/\?/g, "?").replace(/"/g, "'").replace(/</g, "《").replace(/>/g, "》"), filename = filename.replace(/[\/\\*|]+/g, "-").replace(/:/g, ":").replace(/\?/g, "?").replace(/"/g, "'").replace(/</g, "《").replace(/>/g, "》"), "blob" === type ? download_blob(url, filename) : "rpc" === type ? function download_rpc(url, filename, rpc_dir) { var type = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "post"; if ("post" === type) { if ("0" === config_config.show_motrix_confirm) return void download_rpc_post({54 行未改动 mergedBlob && 0 !== mergedBlob.size ? (show_merge_progress({ isFinished: !0 }), downloadBlob(mergedBlob, filename)) : message_Message_error("合并视频失败"); }).catch(function(error) { console.error(error), "AbortError" !== error.name ? (controller.signal.aborted || controller.abort(), console.error(error), "AbortError" !== error.name ? (controller.signal.aborted || controller.abort(), message_Message_error("合并下载失败")) : message_Message_warning("已取消下载"); }).finally(function() { download_blob_merge_clicked = !1; });3 行未改动 $("body").on("click", 'input[name="option_video"]', function(event) { function get_option_index(element) { return element && parseInt(element.id.split("_")[1]) || 0; } if ($(this).is(":checked") ? $(this).parent().css("color", "rgba(0,0,0,1)") : $(this).parent().css("color", "rgba(0,0,0,0.5)"), if ($(this).is(":checked") ? $(this).parent().css("color", "rgba(0,0,0,1)") : $(this).parent().css("color", "rgba(0,0,0,0.5)"), event.ctrlKey || event.altKey) { var current_select_option_index = get_option_index(event.target), option_videos = download_toConsumableArray(document.getElementsByName("option_video")); if (event.target.checked) for (var i = get_option_index(option_videos.filter(function(e) { return e.checked && get_option_index(e) < current_select_option_index; }).slice(-1)[0]); i < current_select_option_index; i++) option_videos[i].checked = !0, }).slice(-1)[0]); i < current_select_option_index; i++) option_videos[i].checked = !0, option_videos[i].parentNode.style.color = "rgba(0,0,0,1)"; else for (var _i = get_option_index(option_videos.filter(function(e) { return !e.checked && get_option_index(e) < current_select_option_index; }).slice(-1)[0]); _i < current_select_option_index; _i++) option_videos[_i].checked = !1, }).slice(-1)[0]); _i < current_select_option_index; _i++) option_videos[_i].checked = !1, option_videos[_i].parentNode.style.color = "rgba(0,0,0,0.5)"; } }); for (var video_html = "", i = 0; i < total; i++) video_html += "" + '<label for="option_'.concat(i, '"><div style="color:rgba(0,0,0,0.5);">\n <input type="checkbox" id="option_').concat(i, '" name="option_video" value="').concat(i, '">\n P').concat(i + 1, " ").concat(vb.title(i + 1), "\n </div></label><hr>"); 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, 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 {22 行未改动 }); } (dl_video || dl_audio) && ("post" === rpc_type() && "0" !== config_config.show_motrix_confirm ? checkMotrixRunningBeforeExecute(function() { download_videos([].concat(video_tasks)); }) : download_videos([].concat(video_tasks))), dl_subtitle && (1 === video_tasks.length ? download_subtitle_vtt(video_tasks[0].p, video_tasks[0].filename) : download_subtitle_vtt_zip([].concat(video_tasks), new JSZip)), }) : download_videos([].concat(video_tasks))), dl_subtitle && (1 === video_tasks.length ? download_subtitle_vtt(video_tasks[0].p, video_tasks[0].filename) : download_subtitle_vtt_zip([].concat(video_tasks), new JSZip)), dl_danmaku && (1 === video_tasks.length ? download_danmaku_ass(video_tasks[0].cid, video_tasks[0].filename) : download_danmaku_ass_zip([].concat(video_tasks), new JSZip)); }), $("#dl_format").val(config_config.format), $("#dl_quality").val(q); var dl_format_change_evt = function dl_format_change_evt(format) { "dash" === format ? ($("#dl_audio").prop("checked", !0).parent().css("color", "rgba(0,0,0,1)"), $("#dl_audio").prop("disabled", !1)) : ($("#dl_audio").prop("checked", !1).parent().css("color", "rgba(0,0,0,0.5)"), "dash" === format ? ($("#dl_audio").prop("checked", !0).parent().css("color", "rgba(0,0,0,1)"), $("#dl_audio").prop("disabled", !1)) : ($("#dl_audio").prop("checked", !1).parent().css("color", "rgba(0,0,0,0.5)"), $("#dl_audio").prop("disabled", !0)); }; if (dl_format_change_evt(config_config.format), $("body").on("change", "#dl_format", function() { var format = $(this).val();4 行未改动 var _$$, h = null === (_$$ = $("#playlist-video-action-list")[0]) || void 0 === _$$ ? void 0 : _$$.scrollHeight; if (!h) return; var timer1 = null, timer2 = null, old_h = h, change_count = 0, not_change_count = 0, load_down = !0; timer1 = setInterval(function() { load_down ? $("#playlist-video-action-list").scrollTop($("#playlist-video-action-list")[0].scrollHeight) : $("#playlist-video-action-list").scrollTop(0), load_down ? $("#playlist-video-action-list").scrollTop($("#playlist-video-action-list")[0].scrollHeight) : $("#playlist-video-action-list").scrollTop(0), load_down = !load_down, not_change_count > 12 && clearInterval(timer1); }, 1500), timer2 = setInterval(function() { (h = $("#playlist-video-action-list")[0].scrollHeight) > old_h ? (!change_count && MessageBox_confirm("正在加载视频列表,请稍后...", null, function() { clearInterval(timer1), clearInterval(timer2); }), change_count++, not_change_count = 0) : not_change_count++, old_h = h, not_change_count > 12 && (clearInterval(timer1), }), change_count++, not_change_count = 0) : not_change_count++, old_h = h, not_change_count > 12 && (clearInterval(timer1), clearInterval(timer2), change_count > 0 && (message_Message_info("视频列表加载结束"), download_all())); }, 500); } },131 行未改动全部展开 $("#video_download").hide(), $("#video_download_2").hide(); break; } } config_config.host_key !== old_config.host_key && (check.refresh(), $("#video_url").attr("href", "#"), 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)/) || MessageBox_alert("检测到当前RPC不是localhost本地接口,即将跳转到AriaNg网页控制台页面;请查看控制台RPC接口参数是否正确,第一次加载可能较慢请耐心等待;配置好后即可使用脚本进行远程下载,使用期间不用关闭AriaNg页面!", function() { Download.open_ariang({ domain: config_config.rpc_domain, port: config_config.rpc_port,43 行未改动 port: config_config.rpc_port, path: config_config.rpc_path, token: config_config.rpc_token }, ariang_window = window.bp_aria2_window; if (ariang_window && !ariang_window.closed) return ariang_window.location.href = config_config.ariang_host + Download.get_ariang_set_hash(rpc), if (ariang_window && !ariang_window.closed) return ariang_window.location.href = config_config.ariang_host + Download.get_ariang_set_hash(rpc), void message_Message_info("已同步配置"); Download.open_ariang(rpc); } };42 行未改动 } function auth_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, auth_toPropertyKey(o.key), o); } } function auth_toPropertyKey(t) {12 行未改动 var api_url, api_url_temp, Auth = function() { function Auth() { !function auth_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }(this, Auth), this.auth_clicked = !1, this.auth_window = null, this.TV_KEY = "4409e2ce8ffd12b8", }(this, Auth), this.auth_clicked = !1, this.auth_window = null, this.TV_KEY = "4409e2ce8ffd12b8", this.TV_SEC = "59b43e04ad6965f34319062b478f83dd"; } return function auth_createClass(e, r, t) { return r && auth_defineProperties(e.prototype, r), t && auth_defineProperties(e, t), return r && auth_defineProperties(e.prototype, r), t && auth_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }(Auth, [ {75 行未改动 local_id: "0", ts: Date.now().toString() }, _this3.TV_SEC) }).then(function(res) { !res.code && res.data ? (console.log("login success"), is_login = 1, _this3.doAuth(res.data), !res.code && res.data ? (console.log("login success"), is_login = 1, _this3.doAuth(res.data), box.affirm()) : 86038 === res.code && box.affirm(); }); }, 3e3); }7 行未改动 if (res && !res.code) { var _res$data2 = res.data, url = _res$data2.url, auth_code = _res$data2.auth_code; _this4.auth_window = window.open(url); var is_login = 0, timer = setInterval(function() { if (!_this4.auth_window || _this4.auth_window.closed) return clearInterval(timer), if (!_this4.auth_window || _this4.auth_window.closed) return clearInterval(timer), _this4.auth_clicked = !1, void (is_login || message_Message_info("登陆失败!")); _ajax({ url: "https://passport.bilibili.com/x/passport-tv-login/qrcode/poll", type: "POST",4 行未改动 local_id: "0", ts: Date.now().toString() }, _this4.TV_SEC) }).then(function(res) { !res.code && res.data ? (console.log("login success"), _this4.doAuth(res.data), !res.code && res.data ? (console.log("login success"), _this4.doAuth(res.data), is_login = 1, _this4.auth_window.close()) : 86038 === res.code && _this4.auth_window.close(); }).catch(function() { return _this4.auth_window.close(); });11 行未改动 url: "".concat(config_config.base_api).concat(config_config.base_api.endsWith("/") ? "" : "/", "auth/?act=logout&auth_id=").concat(auth_id, "&auth_sec=").concat(auth_sec), type: "GET", dataType: "json" }).then(function(res) { res.code ? message_Message_warning("注销失败") : (message_Message_success("注销成功"), store.set("auth_id", ""), store.set("auth_sec", ""), store.set("auth_time", "0"), store.set("access_key", ""), res.code ? message_Message_warning("注销失败") : (message_Message_success("注销成功"), store.set("auth_id", ""), store.set("auth_sec", ""), store.set("auth_time", "0"), store.set("access_key", ""), $("#auth").val("0")); }).finally(function() { return _this5.auth_clicked = !1; });2 行未改动 }, { key: "doAuth", value: function doAuth(param) { var _this6 = this; this.auth_window && !this.auth_window.closed && (this.auth_window.close(), this.auth_window = null), this.auth_window && !this.auth_window.closed && (this.auth_window.close(), this.auth_window = null), ajax({ url: "".concat(config_config.base_api).concat(config_config.base_api.endsWith("/") ? "" : "/", "auth/?act=login&").concat(Object.entries({ auth_id: store.get("auth_id"), auth_sec: store.get("auth_sec")3 行未改动 type: "POST", contentType: "application/json", data: JSON.stringify(auth_objectSpread({}, param)) }).then(function(res) { res.code ? message_Message_warning("授权失败") : (message_Message_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", param.access_token), res.code ? message_Message_warning("授权失败") : (message_Message_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", param.access_token), store.set("auth_time", Date.now()), $("#auth").val("1")); }).finally(function() { return _this6.auth_clicked = !1; });50 行未改动 user.lazyInit(!0); var vb = video.base(), _ref = [ vb.type(), vb.aid(), vb.p(), vb.cid(), vb.epid() ], type = _ref[0], aid = _ref[1], p = _ref[2], cid = _ref[3], epid = _ref[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 _ref2 = [ store.get("auth_id"), store.get("auth_sec") ], auth_id = _ref2[0], auth_sec = _ref2[1]; if (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_Message_info("开始请求"), if (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_Message_info("开始请求"), api.get_url(function(res) { if (res && !res.code) { var _url, _url_; if (message_Message_success("请求成功"), res.times && message_Message_info("剩余请求次数:".concat(res.times)), if (message_Message_success("请求成功"), res.times && message_Message_info("剩余请求次数:".concat(res.times)), res.url) _url = res.url.replace("http://", "https://"), _url_ = "#"; else { if (!res.video || !res.audio) return void message_Message_warning("数据错误"); _url = res.video.replace("http://", "https://"), _url_ = res.audio.replace("http://", "https://"); } $("#video_url").attr("href", _url), $("#video_url").attr("download", vb.filename() + Download.url_format(_url)), $("#video_download").show(), "#" !== _url_ && ($("#video_url_2").attr("href", _url_), $("#video_url_2").attr("download", vb.filename() + "_audio.mp4"), $("#video_download_2").show()), (user.needReplace() || vb.isLimited() || "1" === config_config.replace_force) && player.replace_player(_url, _url_), $("#video_url").attr("href", _url), $("#video_url").attr("download", vb.filename() + Download.url_format(_url)), $("#video_download").show(), "#" !== _url_ && ($("#video_url_2").attr("href", _url_), $("#video_url_2").attr("download", vb.filename() + "_audio.mp4"), $("#video_download_2").show()), (user.needReplace() || vb.isLimited() || "1" === config_config.replace_force) && player.replace_player(_url, _url_), "1" === config_config.auto_download && $("#video_download").click(); } }); else { message_Message_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.isLimited() || "1" === config_config.replace_force) && !$("#bp_dplayer")[0] && player.replace_player(url, url_2), url && "#" !== url && ($("#video_download").show(), "dash" === config_config.format && $("#video_download_2").show(), (user.needReplace() || vb.isLimited() || "1" === config_config.replace_force) && !$("#bp_dplayer")[0] && player.replace_player(url, url_2), "1" === config_config.auto_download && $("#video_download").click()); } }, video_download: function video_download() {74 行未改动 if ("more" !== key) { var item = toolbar_obj.find(".toolbar-left-item-wrap").eq(0).clone(); item.attr("id", key); var svg = svg_map[key].replaceAll("#757575", "currentColor").replace("class", 'class="'.concat(item.find("svg").attr("class"), '"')), span = item.find("span").text(btn_list[key]), item_div = item.find("div").eq(0); item_div.attr("title", btn_list[key]), item_div.removeClass("on"), item_div.children().remove(), item_div.attr("title", btn_list[key]), item_div.removeClass("on"), item_div.children().remove(), item_div.append(svg).append(span), left.append(item); } else { var more_map = btn_list[key], el = "" + '<div class="more">更多<div class="more-ops-list">\n <ul>'.concat(Object.keys(more_map).map(function(key) { return '<li><span id="'.concat(key, '">').concat(more_map[key], "</span></li>");8 行未改动 toolbar_obj_2.attr("id", "bp_toolbar"); var left = toolbar_obj_2.find(".video-toolbar-content_left"), right = toolbar_obj_2.find(".video-toolbar-content_right"); toolbar_obj_2.find(".video-toobar_title").remove(), left.children().remove(); var watchlater = right.find(".watchlater").clone(); right.children().remove(), right.append(watchlater), toolbar_obj_2.find(".video-desc-wrapper").remove(), right.children().remove(), right.append(watchlater), toolbar_obj_2.find(".video-desc-wrapper").remove(), Object.keys(btn_list).map(function(key) { if ("more" !== key) { var item = toolbar_obj.find(".video-toolbar-content_item").eq(0).clone(); item.attr("id", key), item.attr("title", btn_list[key]); var svg = svg_map[key].replaceAll("#757575", "currentColor"), item_icon = item.find(".content-item_icon").eq(0); item_icon.removeClass("ic_like"), item_icon.html(svg), item.html(""), item.append(item_icon), item_icon.removeClass("ic_like"), item_icon.html(svg), item.html(""), item.append(item_icon), item.append(btn_list[key]), left.append(item); } else { var list = watchlater.find(".more-list"), list_li = list.children().eq(0); list.children().remove();39 行未改动 }).join(""); return "" + '<div class="'.concat(main_class_name, '">\n ').concat(toolbar_elements, "\n ").concat(more_style, "\n </div>"); }(toolbar_class, [ span_class, span_class_svg, span_class_text ])); } else $("#toolbar_module")[0] && $("#toolbar_module").after('<div id="bp_toolbar" class="tool-bar clearfix report-wrap-module report-scroll-module media-info" scrollshow="true"> <div id="setting_btn" class="like-info"> <i class="iconfont icon-add"></i><span>脚本设置</span> </div> <div id="bilibili_parse" class="like-info"> <i class="iconfont icon-customer-serv"></i><span>请求地址</span> </div> <div id="video_download" class="like-info" style="display:none"> <i class="iconfont icon-download"></i><span>下载视频</span> </div> <div id="video_download_2" class="like-info" style="display:none"> <i class="iconfont icon-download"></i><span>下载音频</span> </div> <div id="video_download_all" class="like-info"> <i class="iconfont icon-download"></i><span>批量下载</span> </div> <div class="more">更多<div class="more-ops-list"> <ul> <li><span id="download_danmaku">下载弹幕</span></li> <li><span id="download_subtitle">下载字幕</span></li> </ul> </div> </div> <style>.tool-bar .more{float:right;cursor:pointer;color:#757575;font-size:16px;transition:all .3s;position:relative;text-align:center}.tool-bar .more:hover .more-ops-list{display:block}.tool-bar:after{display:block;content:"";clear:both}.more-ops-list{display:none;position:absolute;width:80px;left:-65px;z-index:30;text-align:center;padding:10px 0;background:#fff;border:1px solid #e5e9ef;box-shadow:0 2px 4px 0 rgba(0,0,0,.14);border-radius:2px;font-size:14px;color:#222}.more-ops-list li{position:relative;height:34px;line-height:34px;cursor:pointer;transition:all .3s}.more-ops-list li:hover{color:#00a1d6;background:#e7e7e7}</style> </div> '); $("#limit-mask-wall")[0] && $("#limit-mask-wall").remove(), $("#video_download").hide(), $("#limit-mask-wall")[0] && $("#limit-mask-wall").remove(), $("#video_download").hide(), $("#video_download_2").hide(); } function main_typeof(o) { return main_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {42 行未改动 } function main_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, main_toPropertyKey(o.key), o); } } function main_toPropertyKey(t) {15 行未改动 if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }(this, Main), console.log("\n".concat(" %c bilibili-parse-download.user.js v", "2.9.2", " ").concat("90a6675", " %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(e, r, t) { return r && main_defineProperties(e.prototype, r), t && main_defineProperties(e, t), return r && main_defineProperties(e.prototype, r), t && main_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }(Main, [ { key: "loadToolbar", value: function loadToolbar() { var timer, timeout, loading = !1; timer = setInterval(function() { document.getElementById("nav-searchform") && (loading || (loading = !0, initToolbar()), document.getElementById("nav-searchform") && (loading || (loading = !0, initToolbar()), clearInterval(timer)); }, 500); try { timeout = (timeout = config_config.show_ui_timeout ? parseInt(config_config.show_ui_timeout) : 8) > 0 ? timeout : 8; } catch (err) { console.error("show_ui_timeout err:", err); } setTimeout(function() { if (clearInterval(timer), !loading) { if (console.warn("waiting timeout..."), "1" === config_config.show_ui_confirm) return "1" === config_config.show_ui_confirm_load_force ? (loading = !0, if (console.warn("waiting timeout..."), "1" === config_config.show_ui_confirm) return "1" === config_config.show_ui_confirm_load_force ? (loading = !0, void initToolbar()) : void MessageBox_confirm("加载脚本工具栏超时,建议刷新页面重新加载,是否强制加载工具栏?", initToolbar, null); message_Message_warning("工具栏加载异常,已延迟加载"), setTimeout(function() { loading || (loading = !0, initToolbar()), message_Message_info("工具栏已重新加载"); }, 5e3);6 行未改动 var root_div = document.createElement("div"); root_div.id = "bp_root", document.body.append(root_div), function initConfig(el) { var options = '<option value="0">关闭</option>'; for (var k in hostMap) options += '<option value="'.concat(k, '">').concat(hostMap[k], "</option>"); for (var _k in config = config.replace("{{host_key_options}}", options), options = '<option value="0">与播放器相同</option>', for (var _k in config = config.replace("{{host_key_options}}", options), options = '<option value="0">与播放器相同</option>', videoQualityMap) options += '<option value="'.concat(_k, '">').concat(videoQualityMap[_k], "</option>"); config = config.replace("{{video_quality_options}}", options), el && $(el)[0] ? $(el).append(config) : $("body").append(config); var tabLinks = document.querySelectorAll("#bp_config .tab-link"), panels = document.querySelectorAll("#bp_config .tab-panel"), showTab = function showTab(id) { panels.forEach(function(p) {35 行未改动 bp_aria2_window && !bp_aria2_window.closed && bp_aria2_window.close(); }; }("#".concat(root_div.id)), function initMessage(el) { el && $(el)[0] ? $(el).append(message) : $("body").append(message); }("#".concat(root_div.id)), this.loadToolbar(), user.lazyInit(), auth.checkLoginStatus(), check.refresh(), $("#".concat(root_div.id)).append('<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/dplayer/1.25.0/DPlayer.min.css">'), $("#".concat(root_div.id)).append('<a id="video_url" style="display:none;" target="_blank" referrerpolicy="origin" href="#"></a>'), }("#".concat(root_div.id)), this.loadToolbar(), user.lazyInit(), auth.checkLoginStatus(), check.refresh(), $("#".concat(root_div.id)).append('<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/dplayer/1.25.0/DPlayer.min.css">'), $("#".concat(root_div.id)).append('<a id="video_url" style="display:none;" target="_blank" referrerpolicy="origin" href="#"></a>'), $("#".concat(root_div.id)).append('<a id="video_url_2" style="display:none;" target="_blank" referrerpolicy="origin" href="#"></a>'); } }, { key: "run",30 行未改动