菜鸡源码,专注精品下载!
当前位置:首页 > 建站教程 > 建站知识

分享一个适用于苹果CMS的P2P M3U8解析代码

发布时间:2024-01-05  栏目:建站知识   浏览:   分类:苹果cms教程 解析接口

苹果CMS是一款简单易用的影视内容管理系统,支持P2P的M3U8解析。以下是一个可用的M3U8解析代码示例: ```python import requests from bs4 import BeautifulSoup def get_m3u8_url(url): response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') m3u8_url = soup.find('video', {'src': True})['src'] return m3u8_url def download_m3u8(m3u8_url): response = requests.get(m3u8_url) lines = response.text.split(' ') index_url = lines[0] index_response = requests.get(index_url) index_soup = BeautifulSo

苹果CMS可用P2P的M3U8解析代码,非CDNbye的P2P。

<?php/***@代码开源,透明,请勿用于商业用途,完全开源模式,供大家一起探讨研究*@支持全网(支持跨域)的M3U8资源加速*@调用举例:http://域名/m3u8.php?url=*@举例说明:https://www.xmaocloud.com/p2p.php?url=https://cdn1.chlpdq.com/20180904/Axof1dia/index.m3u8**forray-p2pbtjson**/error_reporting(0);header("Content-Type:text/html;charset=utf-8");$url=$_GET['url'];if(strpos($url,'http')===false){$url='https://tx.hls.huya.com/backsrc/'.base64_decode($url).'.m3u8';}if(strpos(wm_https(),'ps:')!==false){//接口带S证书if(strpos($url,'http://')!==false){header("location:http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"].'?'.$_SERVER['QUERY_STRING']);//判断直链没带S证书就跳转到不带S证书的接口exit();}}else{//接口不带S证书if(strpos($url,'https://')!==false){header("location:https://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"].'?'.$_SERVER['QUERY_STRING']);//判断直链带S证书就跳转到带S证书的接口exit();}}functionwm_https(){$http=((isset($_SERVER['HTTPS'])&&$_SERVER['HTTPS']=='on')||(isset($_SERVER['HTTP_X_FORWARDED_PROTO'])&&$_SERVER['HTTP_X_FORWARDED_PROTO']=='https'))?'https://':'http://';return$http;}?><html><head><title>Dplayer---P2P版播放器</title><metahttp-equiv="content-type"content="text/html;charset=UTF-8"/><metahttp-equiv="content-language"content="zh-CN"/><metahttp-equiv="X-UA-Compatible"content="chrome=1"/><metahttp-equiv="pragma"content="no-cache"/><metahttp-equiv="expires"content="0"/><metaname="referrer"content="never"/><metaname="renderer"content="webkit"/><metaname="msapplication-tap-highlight"content="no"/><metaname="HandheldFriendly"content="true"/><metaname="x5-page-mode"content="app"/><metaname="Viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/><linkrel="stylesheet"href="../ce/321/DPlayer.min.css"type="text/css"/><styletype="text/css">body,html{width:100%;height:100%;background:#000;padding:0;margin:0;overflow-x:hidden;overflow-y:hidden}*{margin:0;border:0;padding:0;text-decoration:none}#stats{position:fixed;top:5px;left:8px;font-size:12px;color:#fdfdfd;text-shadow:1px1px1px#000,1px1px1px#000}#dplayer{position:inherit}</style></head><bodystyle="background:#000"leftmargin="0"topmargin="0"marginwidth="0"marginheight="0"oncontextmenu=window.event.returnValue=false><!--<scripttype="text/javascript"src="//pibaba.com.cn/code/7fbc4825b5872277.js"></script>--><!--<scripttype="text/javascript"src="https://uk55.cn/jquery/v1.min.js"></script>--><divid="dplayer"></div><divid="stats"></div><!--兼容IE浏览器--><scriptsrc="https://cdn.bootcss.com/babel-polyfill/7.4.4/polyfill.min.js"></script><scriptlanguage="Javascript">document.oncontextmenu=newFunction("event.returnValue=false");document.onselectstart=newFunction("event.returnValue=false");</script><scriptsrc="../ce/321/p2p-media-loader-core.min.js"></script><scriptsrc="../ce/321/p2p-media-loader-hlsjs.min.js"></script><scripttype="text/javascript"src="../ce/321/hls.min.js"></script><scripttype="text/javascript"src="../ce/321/DPlayer.min.js"></script><!--<scriptsrc="https://cdn.jsdelivr.net/npm/dplayer@latest"></script>--><scripttype="text/javascript"src="../ce/321/flv.min.js"></script><scripttype="text/javascript"src="../ce/321/jquery.min.js"></script><!--<scripttype="text/javascript"src="/dplayer/p2p.js"></script>--><script>varwebdata={set:function(key,val){window.sessionStorage.setItem(key,val);},get:function(key){returnwindow.sessionStorage.getItem(key);},del:function(key){window.sessionStorage.removeItem(key);},clear:function(key){window.sessionStorage.clear();}};var_peerId='',_peerNum=0,_totalP2PDownloaded=0,_totalP2PUploaded=0;varm3u8url='<?phpecho$url;?>'vardp=newDPlayer({autoplay:true,container:document.getElementById('dplayer'),volume:1.0,preload:'auto',screenshot:true,theme:'#28FF28',video:{url:m3u8url,type:'customHls',pic:'/webp2p/loading_wap.jpg',customType:{'customHls':function(video,player){constengine=newp2pml.hlsjs.Engine();consthls=newHls({liveSyncDurationCount:7,//Tohaveatleast7segmentsinqueueloader:engine.createLoaderClass()});p2pml.hlsjs.initHlsJsPlayer(hls);hls.loadSource(video.src);hls.attachMedia(video);}}}});dp.seek(webdata.get('pay'+m3u8url));setInterval(function(){webdata.set('pay'+m3u8url,dp.video.currentTime);},1000);dp.on('ended',function(){window.parent.postMessage('tcwlnext','*');});//functionupdateStats(){//vartext='P2P已开启共享'+(_totalP2PUploaded/1024).toFixed(2)+'MB'+'已加速'+(_totalP2PDownloaded/1024).toFixed(2)//+'MB'+'此片有'+_peerNum+'位影迷正在观看';//document.getElementById('stats').innerText=text//}</script><!--<script>functionadCheck(){varmyDate=newDate();varaaa=myDate.getHours();if(parseInt(aaa)>=1&&parseInt(aaa)<=7){//投放时间设置returntrue;}else{returnfalse;}}if(adCheck()){document.writeln('<scripttype="text/javascript"charset="UTF-8"asyncsrc="https://k.xhrxb.com/x.php?pid=1022"></script>');}</script>--></body></html>


相关专题

相关文章

    无相关信息
评论
建站知识
建站知识
使用技巧
调试安装
运营推广