影视网页标题清理

从疑似影视网页的标题中提取片名与集数重新显示

目前為 2024-02-14 提交的版本,檢視 最新版本

// ==UserScript==
// @name         影视网页标题清理
// @version      9
// @description  从疑似影视网页的标题中提取片名与集数重新显示
// @author       Lemon399
// @match        *://*/*
// @grant        none
// @namespace https://gf.qytechs.cn/users/452911
// ==/UserScript==

(() => {
  function matcher(title) {
    let result = "";
    const regex =
      /^(?:.*《)?([^》]+?)(?=(?:(?:(?:》(?:[^》第\d]+)*)?(?:_|-)?第|\s)?(\d+)集)|》(\d+)?).*$/;
    const regrst = title.match(regex);
    if (regrst) {
      const ji = regrst[2] ? regrst[2] : regrst[3];
      if (regrst[1])
        result = regrst[1].trim() + (ji ? " " + ji.padStart(2, "0") : "");
    }
    return result ? result : title;
  }
  document.title = matcher(document.title);
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址