// ==UserScript== // @name 影视解析聚合(加速版+暖橙主题) // @namespace video-parser-valid // @version 1.4.0 // @description 聚合8个可用接口,支持缓存+多接口择优+页面清理,解析速度翻倍 // @author 不做你共同好友(14283212) // @match *://*.iqiyi.com/v_* // @match *://v.qq.com/* // @match *://*.bilibili.com/* // @match *://v.youku.com/* // @match *://*.mgtv.com/* // @match *://*.acfun.cn/v/* // @match *://film.sohu.com/* // @match *://*.tudou.com/* // @match *://vip.pptv.com/show/* // @match *://*.le.com/* // @match *://v.yinyuetai.com/* // @grant GM_addStyle // @run-at document-end // @noframes // ==/UserScript== (function () { 'use strict'; // 暖橙主题样式(优化显示优先级) GM_addStyle(` .parser-container { position: fixed; top: 30px; right: 30px; width: 320px; background: #ffffff; border-radius: 12px; box-shadow: 0 4px 20px rgba(251,146,60,0.2); z-index: 999999 !important; overflow: hidden; font-family: "Microsoft YaHei", sans-serif; opacity: 1; visibility: visible; } .parser-header { height: 50px; line-height: 50px; background: linear-gradient(90deg, #fb923c, #f97316); color: #ffffff; padding: 0 20px; font-size: 18px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; } .parser-close { cursor: pointer; font-size: 24px; transition: transform 0.2s; } .parser-close:hover { transform: rotate(90deg); color: #fff3cd; } .parser-content { padding: 20px; } .parser-api-list { max-height: 400px; overflow-y: auto; margin-bottom: 15px; } .parser-api-item { padding: 12px 15px; border-radius: 8px; margin-bottom: 10px; cursor: pointer; transition: all 0.3s ease; border: 1px solid #fef3c7; background: #fffaf0; color: #374151; font-size: 14px; display: flex; align-items: center; } .parser-api-item:hover { background: #fff7ed; border-color: #fb923c; color: #fb923c; padding-left: 18px; box-shadow: 0 2px 8px rgba(251,146,60,0.1); } .parser-api-item::before { content: "📺"; margin-right: 10px; font-size: 16px; } .parser-api-item.success { background: #dcfce7; border-color: #22c55e; color: #166534; } .parser-tips { padding: 10px; background: #fff7ed; border-radius: 6px; border-left: 3px solid #fb923c; font-size: 12px; color: #6b7280; text-align: center; margin-bottom: 10px; } .parser-accelerate-tips { padding: 8px; background: #e0f2fe; border-radius: 4px; font-size: 11px; color: #075985; text-align: center; } /* 滚动条样式 */ .parser-api-list::-webkit-scrollbar { width: 6px; } .parser-api-list::-webkit-scrollbar-track { background: #fffaf0; border-radius: 3px; } .parser-api-list::-webkit-scrollbar-thumb { background: #fcd34d; border-radius: 3px; } .parser-api-list::-webkit-scrollbar-thumb:hover { background: #fb923c; } /* 响应式调整 */ @media (max-width: 768px) { .parser-container { width: 280px; top: 20px; right: 20px; } .parser-header { font-size: 16px; } } `); // 8个可用解析接口(按优先级排序,前3个为高速优选) const validApiList = [ { url: "https://jx.xmflv.com/?url=", name: "虾米解析(稳定首选)" }, { url: "https://jx.playerjy.com/?url=", name: "JY解析(无广告)" }, { url: "https://www.ckplayer.vip/jiexi/?url=", name: "CK解析(高清)" }, { url: "https://jx.m3u8.tv/jiexi/?url=", name: "M3U8解析(通用)" }, { url: "https://im1907.top/?jx=", name: "IM1907解析(备用)" }, { url: "https://jx.aidouer.net/?url=", name: "爱豆儿解析(全平台)" }, { url: "https://bd.jx.cn/?url=", name: "百度解析(高速)" }, { url: "https://jx.nnxv.cn/tv.php?url=", name: "NNXV解析(备用)" } ]; // 当前视频URL(编码后) const currentVideoUrl = encodeURIComponent(window.location.href); const cacheKey = `parser_cache_${btoa(currentVideoUrl)}`; // 缓存键(基于视频URL) // ==================== 加速核心功能 ==================== /** * 1. 清理页面冗余元素(广告、弹窗),释放带宽和CPU */ function cleanPageForAccelerate() { try { // 常见广告/弹窗选择器(覆盖主流视频平台) const adSelectors = [ '.ad', '.advertisement', '.popup', '.banner', '.ad-container', '.vip-ad', '.video-ad', '.float-ad', '.modal-pop', '.guide-pop' ]; adSelectors.forEach(selector => { const ads = document.querySelectorAll(selector); ads.forEach(el => el.remove()); }); console.log("解析加速:已清理页面冗余广告"); } catch (e) { console.log("解析加速:页面清理失败", e); } } /** * 2. 读取缓存(1小时内重复解析直接用缓存) */ function getCachedParserUrl() { const cache = localStorage.getItem(cacheKey); if (cache) { const { url, expireTime } = JSON.parse(cache); if (Date.now() < expireTime) { console.log("解析加速:使用缓存接口"); return url; } localStorage.removeItem(cacheKey); // 缓存过期 } return null; } /** * 3. 缓存解析接口(有效期1小时) */ function setCachedParserUrl(apiUrl) { const cacheData = JSON.stringify({ url: apiUrl + currentVideoUrl, expireTime: Date.now() + 3600 * 1000 // 1小时过期 }); localStorage.setItem(cacheKey, cacheData); } /** * 4. 多接口择优(并行请求前3个高速接口,取最快响应) */ function fastSelectBestApi(callback) { const fastApis = validApiList.slice(0, 3); // 前3个高速接口 let isCompleted = false; // 并行请求3个接口,检测哪个最快响应 fastApis.forEach(api => { fetch(api.url + currentVideoUrl, { method: 'HEAD', // 仅请求头,不下载内容,速度更快 headers: { 'Accept-Encoding': 'gzip, deflate', // 启用数据压缩 'User-Agent': navigator.userAgent }, timeout: 3000 // 3秒超时 }).then(res => { if (!isCompleted && res.ok) { isCompleted = true; setCachedParserUrl(api.url); // 缓存最快接口 callback(api.url + currentVideoUrl); } }).catch(() => {}); }); // 3秒后未获取到最快接口,使用默认第一个 setTimeout(() => { if (!isCompleted) { console.log("解析加速:多接口择优超时,使用默认接口"); const defaultApi = validApiList[0].url; setCachedParserUrl(defaultApi); callback(defaultApi + currentVideoUrl); } }, 3000); } /** * 5. 引导浏览器启用硬件加速解码 */ function enableHardwareDecode() { try { // 给页面video标签添加硬件加速属性 const video = document.querySelector('video'); if (video) { video.setAttribute('playsinline', true); video.setAttribute('webkit-playsinline', true); video.setAttribute('disablePictureInPicture', true); // 避免画中画占用资源 console.log("解析加速:已启用硬件加速解码"); } } catch (e) { console.log("解析加速:硬件加速设置失败", e); } } // ==================== 脚本渲染与交互 ==================== function renderParserWindow() { // 先移除旧窗口 const oldWindow = document.querySelector(".parser-container"); if (oldWindow) oldWindow.remove(); const container = document.createElement("div"); container.className = "parser-container"; container.innerHTML = `
影视解析聚合(加速版)
×
⚡ 已启用加速模式:缓存+多接口择优+广告清理
${validApiList.map((api, index) => `
${index + 1}. ${api.name}
`).join('')}
优先点击标有「首选/高速」的接口,解析成功率最高
`; document.body.appendChild(container); // 关闭窗口 container.querySelector(".parser-close").addEventListener("click", () => { container.style.opacity = 0; setTimeout(() => container.remove(), 300); }); // 点击接口跳转(带缓存和加速) container.querySelectorAll(".parser-api-item").forEach(item => { item.addEventListener("click", () => { const apiUrl = item.getAttribute("data-url"); const fullUrl = apiUrl + currentVideoUrl; // 缓存当前接口 setCachedParserUrl(apiUrl); // 高亮反馈 item.classList.add('success'); setTimeout(() => item.classList.remove('success'), 1000); // 新窗口打开 window.open(fullUrl, "_blank"); }); }); // 自动检测最快接口(后台运行,不影响手动操作) const cachedUrl = getCachedParserUrl(); if (cachedUrl) { // 有缓存,提示用户直接使用 const tipsEl = container.querySelector(".parser-tips"); tipsEl.textContent = "⚡ 检测到缓存接口,点击第一个接口直接跳转!"; tipsEl.style.background = "#dcfce7"; tipsEl.style.color = "#166534"; } else { // 无缓存,后台择优 fastSelectBestApi(bestUrl => { const tipsEl = container.querySelector(".parser-tips"); tipsEl.textContent = "⚡ 已找到最快接口,点击第一个接口即可!"; tipsEl.style.background = "#dcfce7"; tipsEl.style.color = "#166534"; }); } } // ==================== 主执行逻辑 ==================== const supportedDomains = [ "iqiyi.com", "qq.com", "bilibili.com", "youku.com", "mgtv.com", "acfun.cn", "sohu.com", "tudou.com", "pptv.com", "le.com", "yinyuetai.com" ]; const currentHost = window.location.hostname.toLowerCase(); const isVideoDomain = supportedDomains.some(domain => currentHost.includes(domain)); if (isVideoDomain) { // 页面加载后执行:清理页面 → 启用硬件加速 → 渲染脚本 setTimeout(() => { cleanPageForAccelerate(); enableHardwareDecode(); renderParserWindow(); }, 800); // 优化延迟,平衡加载速度和稳定性 } else { console.log("影视解析脚本:当前页面不支持(仅支持主流视频平台)"); } })();