您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
清除剧集标题中“集”字后面的字符,以及清理带《》的电影标题
当前为
// ==UserScript== // @name 影视网页标题清理 // @version 5 // @description 清除剧集标题中“集”字后面的字符,以及清理带《》的电影标题 // @author ChatGPT // @match *://*/* // @grant none // @namespace https://greasyfork.org/users/452911 // ==/UserScript== (() => { 'use strict'; const pageTitle = document.title.trim(); const regex = /^(.*)《(.+?)》第(\d+)集.*$/; if (regex.test(pageTitle)) { const matches = pageTitle.match(regex); const title = matches[2]; const episode = matches[3].padStart(2, '0'); const newTitle = `《${title}》第${episode}集`; document.title = newTitle; } else { // 匹配形如 "排球少年第1集高清资源在线播放_完结 - 異世界動漫" 的剧集标题 const episodeRegex1 = /^([^《]+)第(\d+)集.*$/; // 匹配形如 "《云襄传第28集》免费在线播放资源" 的剧集标题 const episodeRegex2 = /《([^》]*?集[^》]*?)》/; let newTitle = pageTitle; if (episodeRegex1.test(pageTitle)) { // 检查是否匹配剧集标题(类型 1) const matches = pageTitle.match(episodeRegex1); // 使用正则表达式提取信息 const title = matches[1].trim(); // 剧集名称为 "排球少年" const episode = String(matches[2]).padStart(2, '0'); // 集数为 "01",在数字前添加一个 0 newTitle = `${title}第${episode}集`; // 新标题为 "排球少年第01集" } else if (episodeRegex2.test(pageTitle)) { // 检查是否匹配剧集标题(类型 2) const matches = pageTitle.match(episodeRegex2); // 使用正则表达式提取信息 const title = matches[1]; // 剧集名称为包含集数 "云襄传第28集" newTitle = `${title} `; // 新标题为 "云襄传第28集" } if (!newTitle.includes('集')) { // 如果新标题仍然不包含“集”字 const regex = /《(.*?)》/; const matches = regex.exec(newTitle); if (matches !== null) { newTitle = matches[1]; // 提取包含在一对《》内的内容 } } document.title = newTitle; // 将提取后的新标题设置为页面的标题 } })();