CC163FullScreen

获取M3U8地址并使用Dplayer播放

目前為 2024-08-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name         CC163FullScreen
// @namespace    https://gf.qytechs.cn/zh-CN/users/135090
// @version      1.4.0
// @description  获取M3U8地址并使用Dplayer播放
// @author       ZWB
// @license      CC
// @run-at       document-end
// @noframes
// @require      https://unpkg.com/[email protected]/dist/DPlayer.min.js
// @require      https://unpkg.com/[email protected]/dist/hls.js
// @match        https://cc.163.com/1*/
// @match        https://cc.163.com/2*/
// @match        https://cc.163.com/3*/
// @match        https://cc.163.com/4*/
// @match        https://cc.163.com/5*/
// @match        https://cc.163.com/6*/
// @match        https://cc.163.com/7*/
// @match        https://cc.163.com/8*/
// @match        https://cc.163.com/9*/
// ==/UserScript==

(function() {
    'use strict';
    var nqcid=__NEXT_DATA__?.query?.ccid;
    var nppid=__NEXT_DATA__?.props?.pageProps?.roomInfoInitData?.live?.cid;
    var cid =  nppid == undefined ? nqcid : nppid;
    //"https://coopapi.cc.163.com/v1/msharelive/share_data/?ccid="+cid;
    if (cid == undefined) {cid= -1;}
    var roomdata=__NEXT_DATA__?.props?.pageProps?.roomInfoInitData?.live;
    if (roomdata?.gametype == 95599){
        cid = -9;
    } else{
        if (cid > 0) {
            var liveurl="//cc.163.com/live/channel/?channelids="+cid;
            fetch(liveurl)
            .then((response) => response.json())
            .then((data) => {return data?.data[0]})
            .then((data)=>{
                var nickname=data?.nickname;
                var cover=data?.cover;
                var sf=data?.sharefile;
                var startat=data?.startat;
                var isaudio=data?.is_audiolive;
                var ccid=data?.ccid;
                setTimeout(function(){
                    document.body.innerHTML=null;
                    document.title=nickname;
                    var vdiv=document.createElement("div");
                    vdiv.id="dplayer";
                    vdiv.style.width="auto";
                    vdiv.style.height="80%";
                    vdiv.style.align="center";
                    var adiv=document.createElement("a");
                    adiv.href="https://cc.163.com/"+ccid;
                    adiv.textContent="直播间"+ccid+"于"+startat+"开播";
                    document.body.append(vdiv);
                    document.body.append(adiv)
                    if(isaudio==1){
                        document.body.innerHTML="<h1>音频直播,暂不支持</h1>";
                    }else{
                        var dp=new DPlayer({
                            container: document.getElementById('dplayer'),
                            live: true,
                            volume: 1.0,
                            video: {
                                url: sf,
                                type: 'hls',
                                pic: cover,
                            },
                        });
                        dp.play();
                    }
                },1500);
            });
        }
    }

})();

QingJ © 2025

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