Greasy Fork

Greasy Fork is available in English.

💖 VIP视频解析

视频解析,多源切换、简洁易用、UI美观、支持爱.优.腾。

目前为 2025-03-02 提交的版本。查看 最新版本

// ==UserScript==
// @name        💖 VIP视频解析
// @namespace   http://greasyfork.icu/zh-CN/users/1409010-i-breathe
// @version     1.3
// @description 视频解析,多源切换、简洁易用、UI美观、支持爱.优.腾。
// @author      I-Breathe
// @run-at      document-start
// @match       http*://*.iqiyi.*/*
// @match       http*://*.qq.*/*
// @match       http*://*.youku.*/*
// @match       http*://*.bilibili.*/*
// @match       http*://*.mgtv.*/*
// @match       http*://*.sohu.*/*
// @match       http*://*.pptv.*/*
// @match       http*://*.le.*/*
// @match       http*://*.acfun.*/*
// @grant       none
// @grant       GM_setValue
// @grant       GM_getValue
// ==/UserScript==

(function() {
    'use strict';

    // ====== 配置区 ======
    const CONFIG = {
        // 按钮参数
        buttonSize: 50,               
        buttonRight: '25px',         
        buttonBottom: '30px',        
        imageUrl: 'https://img13.360buyimg.com/ddimg/jfs/t1/121241/11/19612/181715/5fbac680E636138b5/267dd280e727aff4.jpg', 
        opacity: 0.99,                

        // 呼吸灯颜色参数
        breatheColors: ['#FF00FF95','#00FAFF95','#FFFF0095','#00FFFF95','#00FF0095'], 
        breatheDuration: 25,          
        glowSize: 7,                  

        // 解析接口配置
        parseUrl: GM_getValue('selectedParseUrl', 'https://www.yemu.xyz/?url='), 

        
        parseUrls: [
            ["https://bd.jx.cn/?url=", "冰豆弹幕"],
            ["https://am1907.top/?jx=", "1907解析"],
            ["https://jx.xmflv.cc/?url=", "虾米解析"],
            ["https://jx.xymp4.cc/?url=", "咸鱼解析"],
            ["https://www.yemu.xyz/?url=", "夜幕解析"],
            ["https://jx.77flv.cc/?url=", "77云解析"],
            ["https://www.8090g.cn/jiexi/?url=", "8090g"],
            ["https://jx.playerjy.com/?url=", "PlayerJy"],
            ["https://www.ckplayer.vip/jiexi/?url=", "CkPlay"],
            ["https://www.pangujiexi.com/jiexi/?url=", "盘古解析"],
            ["https://jx.xymp4.cc/?url=", "xymp4"],
            ["https://jx.hls.one/?url=", "HLS解析"],
            ["https://jx.973973.xyz/?url=", "973播放"],
            ["https://jx.nnxv.cn/tv.php?url=", "七哥解析"],
            ["https://jx.2s0.cn/player/?url=", "极速解析"],
            ["https://rdfplayer.mrgaocloud.com/player/?url=", "红狐解析"],
            ["https://jx.m3u8.tv/jiexi/?url=", "M3U8"],
            ["https://www.pouyun.com/?url=", "剖云解析"],
            ["https://www.playm3u8.cn/jiexi.php?url=", "playm3u8"],
            ["https://yparse.ik9.cc/?url=", "ik9云解析"],
            ["https://xiaoapi.cn/API/jx_txsp.php?url=", "腾讯API解析"],
            ["https://xiaoapi.cn/API/jx_yk.php?url=", "优酷API解析"],
            ["https://xiaoapi.cn/API/zs_ewm.php?msg=", "网页二维码生成"],
            ["#", "无法播放更换接口尝试"],
            ["#", "• • •"]
        ]
    };


    let floatingButton;  
    let clickTimer;     

// ====== 样式定义 ======
const styleSheet = document.createElement('style');
styleSheet.textContent = `

    .floating-button {
        position: fixed;       
        z-index: 999999;        
        cursor: pointer;         
        border-radius: 50%;     
        transition: all 0.3s ease; 
    }


    .source-list {
        position: fixed;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        z-index: 999999;
        padding: 10px 0;
        min-width: 150px;

       
        background: rgba(0,0,0,0.5); 
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255,255,255,0.1); 

      
        color: #fff;            
        font-family: "Microsoft YaHei", sans-serif; 
    }


    .source-item {
        padding: 8px 20px;
        cursor: pointer;        
        font-size: 15px;        
        white-space: nowrap;     
        transition: all 0.2s;   
        text-align: center;     


        color: inherit;      
        /* color: #333; */       /* 独立项字体颜色 (取消注释使用) */

       
        &:hover {
            background: rgba(255,255,255,0.1);
            /* color: #FF4081; */
        }


        &[data-selected="true"] {
            color: #FF4081;  
            font-weight: bold;   
        }
    }


    @keyframes breathe {
        0% { box-shadow: 0 0 ${CONFIG.glowSize}px ${CONFIG.glowSize}px ${CONFIG.breatheColors[0]}; }
        33% { box-shadow: 0 0 ${CONFIG.glowSize}px ${CONFIG.glowSize}px ${CONFIG.breatheColors[1]}; }
        66% { box-shadow: 0 0 ${CONFIG.glowSize}px ${CONFIG.glowSize}px ${CONFIG.breatheColors[2]}; }
        100% { box-shadow: 0 0 ${CONFIG.glowSize}px ${CONFIG.glowSize}px ${CONFIG.breatheColors[0]}; }
    }
`;
document.head.appendChild(styleSheet);

    // ====== 功能函数 ======

    /**
     * 创建浮动按钮元素
     * @returns {HTMLImageElement} 创建的按钮元素
     */
    function createFloatingButton() {
        const btn = document.createElement('img');
        btn.src = CONFIG.imageUrl;
        btn.className = 'floating-button';
        btn.style.cssText = `
            right: ${CONFIG.buttonRight};
            bottom: ${CONFIG.buttonBottom};
            width: ${CONFIG.buttonSize}px;
            height: ${CONFIG.buttonSize}px;
            opacity: ${CONFIG.opacity};
            animation: breathe ${CONFIG.breatheDuration}s infinite;
        `;
        return btn;
    }

    /**
     * 创建单个解析源列表项
     * @param {Array} item - 解析源配置项 [url, name]
     * @returns {HTMLDivElement} 列表项元素
     */
    function createSourceListItem([url, name]) {
        const item = document.createElement('div');
        item.className = 'source-item';
        item.textContent = name;
        item.style.color = url === CONFIG.parseUrl ? '#ECECEC' : '#00000099';  /* 列表选中和字体颜色 */

        // 鼠标悬停效果
        item.addEventListener('mouseenter', () =>
            item.style.background = '#f5f5f525');  /* 鼠标悬停背景色 */
        item.addEventListener('mouseleave', () =>
            item.style.background = '');

        // 点击处理
        item.addEventListener('click', (e) => {
            e.stopPropagation();
            CONFIG.parseUrl = url;
            GM_setValue('selectedParseUrl', url);
            document.getElementById('parse-source-list')?.remove();
            floatingButton.style.boxShadow =
                `0 0 6px 6px ${CONFIG.breatheColors[0]}`;
        });

        return item;
    }

    /**
     * 创建解析源选择列表
     */
    function createSourceList() {
        const existingList = document.getElementById('parse-source-list');
        if (existingList) existingList.remove();

        const list = document.createElement('div');
        list.id = 'parse-source-list';
        list.className = 'source-list';
        list.style.cssText = `
            right: ${CONFIG.buttonRight};
            bottom: calc(${CONFIG.buttonBottom} + ${CONFIG.buttonSize + 10}px);
        `;

        // 添加所有解析源项
        CONFIG.parseUrls.forEach(item =>
            list.appendChild(createSourceListItem(item)));

        // 点击外部关闭列表
        const closeHandler = e => {
            if (!list.contains(e.target) && e.target !== floatingButton) {
                list.remove();
                document.removeEventListener('click', closeHandler);
            }
        };
        document.addEventListener('click', closeHandler);

        return list;
    }

    /**
     * 初始化浮动按钮交互事件
     */
    function initButtonEvents() {
        // 鼠标悬停效果
        floatingButton.addEventListener('mouseenter', () => {
            floatingButton.style.opacity = '1';
            floatingButton.style.transform = 'scale(1.1)';
        });
        floatingButton.addEventListener('mouseleave', () => {
            floatingButton.style.opacity = CONFIG.opacity;
            floatingButton.style.transform = 'none';
        });

        // 单击/双击处理
        floatingButton.addEventListener('click', () => {
            clearTimeout(clickTimer);
            clickTimer = setTimeout(() =>
                window.open(CONFIG.parseUrl + location.href), 300);
        });
        floatingButton.addEventListener('dblclick', () => {
            clearTimeout(clickTimer);
            document.body.appendChild(createSourceList());
        });
    }

    // ====== 主初始化函数 ======
    function init() {
        // 创建并插入浮动按钮
        floatingButton = createFloatingButton();
        document.body.appendChild(floatingButton);

        // 初始化事件监听
        initButtonEvents();
    }

    // ====== 启动脚本 ======
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }
})();