// ==UserScript== // @name VIP视频解析助手 - 国内视频平台 // @namespace http://tampermonkey.net/ // @version 4.0.0 // @description 支持爱奇艺、优酷、腾讯、PPTV、1905电影网等平台的VIP视频解析播放工具,提供美观的浮动解析面板,支持多线路选择、拖拽移动、位置记忆等功能。 // @author AI Assistant // @match *://*.iqiyi.com/* // @match *://*.youku.com/* // @match *://*.qq.com/* // @match *://*.pptv.com/* // @match *://*.1905.com/* // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @run-at document-end // @license MIT // ==/UserScript== (function() { 'use strict'; // ==================== 版本信息 ==================== const VERSION = '4.0.0'; // ==================== 配置管理 ==================== const CONFIG = { // 面板位置存储键 PANEL_POS_KEY: 'vip_parser_panel_pos', // 面板状态存储键(最小化/展开) PANEL_STATE_KEY: 'vip_parser_panel_minimized', // 默认解析线路 DEFAULT_LINE: GM_getValue('default_line', 0), // 面板宽度 PANEL_WIDTH: 380, // 存储键名 STORAGE_KEY: 'vip_video_parser_history' }; // ==================== 解析线路配置 ==================== // 注意:以下接口为示例格式,实际使用时请替换为可用的解析接口 const PARSE_LINES = [ { name: '线路一(通用)', url: 'https://jx.xmflv.com/?url=' }, { name: '线路二(备用)', url: 'https://jx.nnxv.cn/tv.php?url=' }, { name: '线路三(极速)', url: 'https://jx.789jiexi.com/?url=' }, { name: '线路四(高清)', url: 'https://jx.playerjy.com/?url=' }, { name: '线路五(稳定)', url: 'https://jx.2s0.cn/player/?url=' } ]; // ==================== 平台识别配置 ==================== const PLATFORMS = { 'iqiyi': { name: '爱奇艺', host: 'iqiyi.com', color: '#00be06', icon: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' }, 'youku': { name: '优酷', host: 'youku.com', color: '#1e90ff', icon: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' }, 'qq': { name: '腾讯视频', host: 'v.qq.com', color: '#ff6b00', icon: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' }, 'pptv': { name: 'PPTV', host: 'pptv.com', color: '#00a0e9', icon: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' }, '1905': { name: '1905电影网', host: '1905.com', color: '#c41e3a', icon: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z' } }; // ==================== 工具函数 ==================== /** * 获取当前平台信息 * @returns {Object|null} */ function getCurrentPlatform() { const hostname = location.hostname; for (const key in PLATFORMS) { if (hostname.includes(PLATFORMS[key].host)) { return { key, ...PLATFORMS[key] }; } } return null; } /** * 获取当前页面视频URL * @returns {string} */ function getCurrentVideoUrl() { return window.location.href; } /** * 获取页面视频标题 * @returns {string} */ function getVideoTitle() { const selectors = [ 'h1[class*="title"]', 'h1[class*="Title"]', '.video-title', '.videoTitle', '[class*="title"][class*="video"]', 'h1', '.film-title' ]; for (const selector of selectors) { const el = document.querySelector(selector); if (el && el.textContent.trim()) { return el.textContent.trim().substring(0, 50); } } return document.title.replace(/[-_].*$/, '').trim() || '未知视频'; } // ==================== 样式注入 ==================== /** * 注入CSS样式 */ function injectStyles() { const styleId = 'vip-parser-styles'; if (document.getElementById(styleId)) return; const style = document.createElement('style'); style.id = styleId; style.textContent = ` /* ===== CSS变量系统 ===== */ :root { --vp-primary: #6366f1; --vp-primary-light: #818cf8; --vp-primary-dark: #4f46e5; --vp-bg: #0f0f23; --vp-bg-secondary: #1a1a2e; --vp-surface: rgba(26, 26, 46, 0.95); --vp-text: #f1f5f9; --vp-text-secondary: #cbd5e1; --vp-text-muted: #94a3b8; --vp-glass: rgba(255, 255, 255, 0.05); --vp-glass-border: rgba(255, 255, 255, 0.1); --vp-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); --vp-shadow-glow: 0 0 40px rgba(99, 102, 241, 0.2); --vp-radius: 16px; --vp-radius-sm: 12px; --vp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); } /* ===== 浮动面板 ===== */ .vp-float-panel { position: fixed; z-index: 99999; width: var(--vp-panel-width, 380px); background: linear-gradient(145deg, rgba(26, 26, 46, 0.98) 0%, rgba(15, 15, 35, 0.99) 100%); border-radius: var(--vp-radius); border: 1px solid var(--vp-glass-border); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); box-shadow: var(--vp-shadow-glow), var(--vp-shadow); overflow: hidden; transition: transform 0.3s ease, opacity 0.3s ease; user-select: none; } .vp-float-panel.minimized { width: auto !important; min-width: 60px; } .vp-float-panel.minimized .vp-panel-body, .vp-float-panel.minimized .vp-panel-footer { display: none !important; } /* ===== 面板头部 ===== */ .vp-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: linear-gradient(90deg, rgba(99,102,241,0.15) 0%, rgba(59,130,246,0.08) 50%, transparent 100%); border-bottom: 1px solid var(--vp-glass-border); cursor: grab; position: relative; } .vp-panel-header:active { cursor: grabbing; } .vp-panel-header::after { content: ''; position: absolute; bottom: 0; left: 18px; right: 18px; height: 1px; background: linear-gradient(90deg, transparent, var(--vp-primary-light), transparent); opacity: 0.4; } .vp-panel-title { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--vp-text); } .vp-panel-icon { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--vp-primary) 0%, var(--vp-primary-dark) 100%); display: flex; align-items: center; justify-content: center; } .vp-panel-icon svg { width: 16px; height: 16px; fill: white; } .vp-panel-controls { display: flex; gap: 6px; } .vp-btn-icon { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--vp-glass-border); background: var(--vp-glass); color: var(--vp-text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--vp-transition); padding: 0; } .vp-btn-icon:hover { background: rgba(255,255,255,0.1); color: var(--vp-text); transform: scale(1.1); } .vp-btn-icon svg { width: 14px; height: 14px; fill: currentColor; } /* ===== 面板内容区 ===== */ .vp-panel-body { padding: 16px 18px; max-height: 400px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--vp-primary) transparent; } .vp-panel-body::-webkit-scrollbar { width: 4px; } .vp-panel-body::-webkit-scrollbar-thumb { background: var(--vp-primary); border-radius: 2px; } /* ===== 视频信息 ===== */ .vp-video-info { margin-bottom: 16px; padding: 12px; border-radius: var(--vp-radius-sm); background: var(--vp-glass); border: 1px solid var(--vp-glass-border); } .vp-video-title { font-size: 13px; font-weight: 500; color: var(--vp-text); line-height: 1.5; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } .vp-video-platform { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(59, 130, 246, 0.15) 100%); color: var(--vp-primary-light); border: 1px solid rgba(99, 102, 241, 0.2); } /* ===== 线路选择 ===== */ .vp-section { margin-bottom: 16px; } .vp-section-label { font-size: 12px; font-weight: 600; color: var(--vp-text-secondary); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: 0.5px; } .vp-section-label::before { content: ''; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(180deg, var(--vp-primary) 0%, var(--vp-primary-light) 100%); } .vp-select { width: 100%; padding: 10px 14px; border-radius: var(--vp-radius-sm); border: 1px solid var(--vp-glass-border); background: var(--vp-bg-secondary); color: var(--vp-text); font-size: 13px; cursor: pointer; transition: var(--vp-transition); appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; } .vp-select:focus { outline: none; border-color: var(--vp-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); } .vp-select option { background: var(--vp-bg); color: var(--vp-text); } /* ===== 解析按钮 ===== */ .vp-parse-btn { width: 100%; padding: 12px 20px; border-radius: var(--vp-radius-sm); border: none; background: linear-gradient(135deg, var(--vp-primary) 0%, var(--vp-primary-dark) 100%); color: white; font-size: 14px; font-weight: 600; cursor: pointer; transition: var(--vp-transition); display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; overflow: hidden; } .vp-parse-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: left 0.5s ease; } .vp-parse-btn:hover::before { left: 100%; } .vp-parse-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4); } .vp-parse-btn:active { transform: scale(0.98); } .vp-parse-btn svg { width: 18px; height: 18px; fill: currentColor; } /* ===== 提示信息 ===== */ .vp-tip { margin-top: 12px; padding: 10px 12px; border-radius: var(--vp-radius-sm); background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.15); font-size: 11px; color: #fbbf24; line-height: 1.6; } /* ===== 面板底部 ===== */ .vp-panel-footer { padding: 12px 18px; border-top: 1px solid var(--vp-glass-border); display: flex; align-items: center; justify-content: space-between; } .vp-version { font-size: 11px; color: var(--vp-text-muted); } .vp-shortcut { font-size: 11px; color: var(--vp-text-muted); display: flex; align-items: center; gap: 4px; } .vp-shortcut kbd { padding: 2px 6px; border-radius: 4px; background: var(--vp-bg-secondary); border: 1px solid var(--vp-glass-border); font-family: inherit; font-size: 10px; color: var(--vp-primary-light); } /* ===== 最小化状态按钮 ===== */ .vp-minimized-btn { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--vp-primary) 0%, var(--vp-primary-dark) 100%); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); transition: var(--vp-transition); animation: vp-pulse 2s ease-in-out infinite; } .vp-minimized-btn:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6); } @keyframes vp-pulse { 0%, 100% { box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); } 50% { box-shadow: 0 4px 25px rgba(99, 102, 241, 0.6); } } /* ===== 拖拽时的样式 ===== */ .vp-float-panel.dragging { opacity: 0.9; transform: scale(1.02); box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5); } /* ===== 动画 ===== */ @keyframes vp-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .vp-animate-in { animation: vp-fade-in 0.4s ease; } `; document.head.appendChild(style); } // ==================== 面板管理 ==================== /** * 创建解析面板 */ function createPanel() { const platform = getCurrentPlatform(); if (!platform) return; // 读取保存的位置 const savedPos = GM_getValue(CONFIG.PANEL_POS_KEY, null); const savedMinimized = GM_getValue(CONFIG.PANEL_STATE_KEY, false); const panel = document.createElement('div'); panel.id = 'vp-float-panel'; panel.className = 'vp-float-panel' + (savedMinimized ? ' minimized' : ''); // 设置位置 if (savedPos) { panel.style.left = savedPos.x + 'px'; panel.style.top = savedPos.y + 'px'; } else { panel.style.right = '20px'; panel.style.top = '80px'; } const isMinimized = savedMinimized; panel.innerHTML = `