// ==UserScript== // @name 豆瓣电影页面直接搜索资源链接 // @namespace https://XXXXX/ // @version 0.1 // @description 豆瓣电影标题下方显示资源链接,仅搜索纯中文片名 // @author XXXXX // @match *://movie.douban.com/subject/* // @license GPL-3.0-only // @grant none // ==/UserScript== (function () { 'use strict'; // 资源站点配置 const resourceSites = [ { name: '激光影视', url: 'https://hellociqryx6e.com/vod/search/{title}' }, { name: '短剧搜索', url: 'https://so.duanjuku.top/search.php?q={title}' }, { name: '4K资源', url: 'https://xuexizhinan.com/?post_type=book&s={title}' }, { name: '两个BT', url: 'https://www.bttwo.top/search?q={title}' }, { name: 'seedhub', url: 'https://www.seedhub.cc/s/{title}' }, { name: '音范丝', url: 'https://www.yinfans.me/?s={title}' }, { name: '哒哒4K', url: 'https://www.da4k.com/?cat=&s={title}' }, { name: '4K小站', url: 'https://4kysxz.top/search.php?q={title}' }, { name: '不太灵', url: 'https://web5.mukaku.com/search?sb={title}' } ]; // 提取纯中文片名函数 function getPureChineseTitle(rawText) { // 匹配所有汉字,拼接成纯中文名称 const chineseList = rawText.match(/[\u4e00-\u9fff]/g); return chineseList ? chineseList.join('') : ''; } try { // 优先获取原生中文片名(豆瓣h1内专门存储中文名的标签) let rawTitle = document.querySelector('h1 span[property="v:itemreviewed"]')?.innerText || ''; // 降级:取不到专用标签就拿整个h1文本处理 if (!rawTitle) rawTitle = document.querySelector('h1').innerText; if (!rawTitle) return; // 过滤,只保留中文,去掉英文、年份、符号 const title = getPureChineseTitle(rawTitle); // 无中文片名直接退出 if (!title) return; // 注入基础样式 const style = document.createElement('style'); style.textContent = ` .resource-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 20px; } .resource-links a { padding: 4px 8px; border: 1px solid #e5e5e5; border-radius: 4px; color: #37a; text-decoration: none; font-size: 14px; } .resource-links a:hover { background: #f5f5f5; text-decoration: underline; } `; document.head.appendChild(style); // 创建链接容器并插入页面 const container = document.createElement('div'); container.className = 'resource-links'; document.querySelector('h1').after(container); // 生成资源链接(仅纯中文搜索词) resourceSites.forEach(site => { const link = document.createElement('a'); link.href = site.url.replace('{title}', encodeURIComponent(title)); link.target = '_blank'; link.textContent = site.name; container.appendChild(link); }); } catch (e) { console.error('脚本运行异常:', e); } })();