将形如「/s/video/*」的链接重定向至「/video/*」
// ==UserScript==
// @name Bilibili 主站重定向
// @namespace https://www.imbytecat.com/
// @version 1.2.3
// @description 将形如「/s/video/*」的链接重定向至「/video/*」
// @author imbytecat
// @match *://*.bilibili.com/s/*
// @run-at document-start
// @grant none
// @license MIT
// ==/UserScript==
(() => {
const re = /^(http|https):\/\/(www.)?bilibili.com\/s\/video\/.+/;
const url = new URL(location.href);
if (re.test(url.href)) {
window.stop();
url.pathname = url.pathname.replace(/\/s/, "");
location.replace(url);
}
})();