Greasy Fork is available in English.
从疑似影视网页的标题中提取片名与集数重新显示
当前为
// ==UserScript==
// @name 影视网页标题清理
// @version 7
// @description 从疑似影视网页的标题中提取片名与集数重新显示
// @author Lemon399
// @match *://*/*
// @grant none
// @namespace http://greasyfork.icu/users/452911
// ==/UserScript==
function matcher(title) {
let result = "";
const regex = /^(?:.*《)?([^》]+?)(?=(?:》?_?第|\s)?(\d+)集|》).*$/;
const regrst = title.match(regex);
if (regrst) {
const [_full, vname, num] = regrst;
const numtxt = num ? " " + num.padStart(2, "0") : "";
if (vname) result = `${vname.trim()}${numtxt}`;
}
return result;
}
const parsed = matcher(document.title);
if (parsed) document.title = parsed;