小鹅通直播回放链接解密成功提示

成功获取m3u8地址后,并提示用户点击右侧按钮复制m3u8地址

当前为 2025-03-06 提交的版本,查看 最新版本

// ==UserScript==
// @name         小鹅通直播回放链接解密成功提示
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  成功获取m3u8地址后,并提示用户点击右侧按钮复制m3u8地址
// @author       破坏游戏的孩子
// @match        https://*.h5.xiaoeknow.com/v3/course/alive/*
// @grant        GM_xmlhttpRequest
// @grant        GM_setClipboard
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.browser.min.js
// @license      未经许可,禁止修改 
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前URL参数
    const urlParams = new URLSearchParams(window.location.search);
    const appId = urlParams.get('app_id');
    const aliveId = window.location.pathname.split('/').pop();

    if (appId && aliveId) {
        // 拼接接口地址
        const apiUrl = `https://${appId}.h5.xiaoeknow.com/_alive/v3/get_lookback_list?app_id=${appId}&alive_id=${aliveId}`;

        // 发送请求获取数据
        GM_xmlhttpRequest({
            method: "GET",
            url: apiUrl,
            onload: function(response) {
                try {
                    const data = JSON.parse(response.responseText);
                    const videoUrl = data.data[0].line_sharpness[0].url;

                    // 创建复制按钮
                    const copyButton = document.createElement('button');
                    copyButton.innerText = '复制m3u8地址';
                    copyButton.style.position = 'fixed';
                    copyButton.style.right = '20px';
                    copyButton.style.top = '50%';
                    copyButton.style.transform = 'translateY(-50%)';
                    copyButton.style.zIndex = '9999';
                    copyButton.style.padding = '10px 20px';
                    copyButton.style.backgroundColor = '#007bff';
                    copyButton.style.color = '#fff';
                    copyButton.style.border = 'none';
                    copyButton.style.borderRadius = '5px';
                    copyButton.style.cursor = 'pointer';
                    copyButton.style.fontSize = '14px';

                    // 添加点击事件
                    copyButton.addEventListener('click', () => {
                        GM_setClipboard(videoUrl, 'text');
                        copyButton.innerText = '已复制!';
                        setTimeout(() => {
                            copyButton.innerText = '复制m3u8地址';
                        }, 2000);
                    });

                    // 将按钮添加到页面
                    document.body.appendChild(copyButton);

                    // 创建提示信息
                    const messageDiv = document.createElement('div');
                    messageDiv.innerHTML = `
                        <div style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9998; text-align: center; background: rgba(0,0,0,0.8); padding: 20px; border-radius: 10px; color: #fff;">
                            <h2 style="margin: 0;">解密直播回放链接成功!</h2>
                            <p>请点击右侧蓝色字【复制m3u8地址】</p>
                        </div>
                    `;
                    document.body.appendChild(messageDiv);

                    // 燃放烟花效果
                    confetti({
                        particleCount: 100,
                        spread: 160,
                        origin: { y: 0.6 }
                    });

                    // 3秒后移除提示信息
                    setTimeout(() => {
                        messageDiv.remove();
                    }, 5000);

                } catch (e) {
                    console.error('解析JSON失败:', e);
                }
            },
            onerror: function(error) {
                console.error('请求失败:', error);
            }
        });
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址