fix: support Bilibili 旧播放页

This commit is contained in:
OverflowCat 2023-08-06 22:36:44 +08:00
parent 3ce55c8647
commit cc18961fe4

View File

@ -4,7 +4,7 @@
// @description 检查 BiliBili 视频是否已经存档到 Internet Archive。
// @author yzqzss
// @match https://www.bilibili.com/video/*
// @run-at document-end
// @run-at document-start
// @grant GM_xmlhttpRequest
// @grant unsafeWindow
// ==/UserScript==
@ -12,6 +12,8 @@
(function () {
'use strict';
const initialState = unsafeWindow.__INITIAL_STATE__;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
@ -35,11 +37,11 @@
// 从 URL 获取当前视频的 BV 号
function getBVNumber() {
return unsafeWindow.__INITIAL_STATE__.bvid;
return initialState.bvid;
}
function getPageNumber() {
return unsafeWindow.__INITIAL_STATE__.p;
return initialState.p;
}
function humanReadableUpperPartMap(string, backward) {
@ -208,5 +210,5 @@
}
}
main();
document.addEventListener("DOMContentLoaded", main);
})();