酷9直播源获取:beesport节目js代码

前言

之前文章有些酷9的request的get方法获取jzb节目,今天根据酷9的request的post方法获取beesport的节目。

来源

节目根据影视的python代码而来:

{
  "name""BeeSport直播(python)",
  "type"3,
  "api""https://json.doube.eu.org/python/live_beesport.py",
  "ext": {},
  "header": {
    "Referer""https://p.m82xg4z0cdbz7.com/"
  }
}

酷9 JS代码

根据以上的python代码,写的js代码:

function main(item{
    const defaultUrl = 'https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/mp4/xgplayer-demo-720p.mp4';
    
    const headers = {
        'User-Agent''Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
        'Accept''application/json, text/plain, */*',
        'Content-Type''application/json',
        'accept-language''zh-CN,zh;q=0.9',
        'cache-control''no-cache',
        'origin''https://beesport.net',
        'referer''https://beesport.net/live-tv'
    };
    
    const jsonData = JSON.stringify({
        channel`https://live_tv.starcdnup.com/${item.id}/index.m3u8`
    });
    
    const response = ku9.request(
        'https://beesport.net/authorize-channel',
        'POST',
        headers,
        jsonData,
        true
    );
    
    if (response.code !== 200) {
        return { url: defaultUrl, headers: {} };
    }
    
    try {
        const data = JSON.parse(response.body);
        
        if (!data.channels || !Array.isArray(data.channels) || data.channels.length === 0) {
            return { url: defaultUrl, headers: {} };
        }
        
        return { 
            url: data.channels[0], 
            headers: {'referer''https://p.m82xg4z0cdbz7.com/'} 
        };
        
    } catch (e) {
        return { url: defaultUrl, headers: {} };
    }
}

使用方法

将js代码保存到酷9js文件夹下,如bee.js,调用js获取节目:

http://A/ku9/js/bee.js?id=

如:

http://A/ku9/js/bee.js?id=Sky_Sports_F1_Live_TV


源码获取

关注本公众号,后台私信【250606】获取js和节目表

注:节目为全英文且无字幕,可用行不高,仅供学习酷9js代码。

发表评论

您的邮箱地址不会被公开。 必填项已用 * 标注

滚动至顶部