P2P加速解析与伪一次解析源码教程

流氓凡 PHP程序源码 2018-10-05 9.73 K 105

些许代码就可以替代我上个版本发布的对接资源站的“一次”解析源码,实现p2p加速效果,具体速度感觉没什么差别 都图个新鲜感吧!

伪一次解析:不二次任何其他接口的解析文件!

<!DOCTYPE html>
<html>
 <head>
    <title>PHP版P2P播放器</title>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <meta http-equiv="content-language" content="zh-CN" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta name="referrer" content="never" />
    <meta name="renderer" content="webkit" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta name="HandheldFriendly" content="true" />
    <meta name="x5-page-mode" content="app" />
    <meta name="Viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<script type="text/javascript" src="//www.ckplayer.tv/ccdao.js"></script>   
    <link rel="stylesheet" href="//cdn.btjson.com/dplayer/1.22.2/DPlayer.min.css" type="text/css" />
    <style type="text/css">*{margin: 0;padding: 0;font-family: "Microsoft YaHei",SimHei,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;}img{border: 0;}a{color:inherit;text-decoration: none;color:#4B7E9D;}a:hover{text-decoration: underline;}body{background:#000;padding: 0;margin: 0;width:100%;height:100%;color:#fff;overflow:hidden;cursor: default;}.error{position:absolute;width:100%;height:100%;text-align:center;top:50%;margin:-30px 0 0 0;z-index:10;}.player,#dpplayer{position:absolute;width:100%;height:100%;}.dplayer-menu{display:none !important;}.torrentnum{padding: 5px;position: absolute;font-size: 12px;}</style>
    <script type="text/javascript" src="//cdn.btjson.com/hlsjs/0.9.1/hls.min.js"></script>
    <script type="text/javascript" src="//cdn.btjson.com/dplayer/1.22.2/DPlayer.min.js"></script>
    <script type="text/javascript" src="//cdn.btjson.com/p2pjs/1.0/p2p.js"></script>
    <script type="text/javascript" src="//cdn.btjson.com/p2pjs/1.0/hls.plugin.js"></script>
    <script type="text/javascript">
    window.onload = function(){
        var dp = new DPlayer({
            container:document.getElementById('dpplayer'),
             autoplay:true,
			 video:{
                quality:[{
                    type:'hls',
                    name:'高清',
                    url:'<?php echo($_REQUEST['url']);?>'
                }],
                defaultQuality:0
            }
        });
        dp.play();
    };
    </script>
    <body>
    <div id="dpplayer"></div>
    </body>
    </html>

以上代码上传到你的网站根目录命名为m3u8.php,那么你的接口就是http://你的域名/m3u8.php?url=

进阶教程:

上一个解析版本https://wslmf.com/post/359.html,我们可以加点代码进行p2p加速的套用。接下来就回复可见吧!

[hide_cv]

我们上传上一次发布的解析源码,配置好资源站地址,我们注意到源码中有个api.php,本次我们就利用这个文件进行对接套用新的p2p加速。

<?php
header("Content-type: text/html; charset=utf-8"); 

$url=$_GET['url'];
$api='http://你的域名/api.php?tp=all&url='.$url;
$get=file_get_contents($api);
$t=str_replace("(","",$get);
$t=str_replace(");","",$t);
$json=json_decode($t,true);

echo'
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>正在播放:【'.$json['title'].'】第'.$json['part'].'集</title>
<style type="text/css">
body{padding: 0;margin:-2;height:100%;width:100%;background-color:#000;color:#999;}
</style>
</head>
 <body>
 <iframe src="../m3u8/?url='.$json['url'].'" width="100%" height="100%" autoplay="autoplay" controls="controls"></iframe>
</body>
</html>
';
?>

复制代码保存文件并命名为vip.php(或者有能力的直接替换掉原来解析源码的index.php文件也行),你新的p2p加速的解析接口雏形就出来了

http://你的域名/vip.php?url=,这就是你新的接口,同样是调用资源站解析出来的然后通过p2p进行加速播放


10/6日新增整合代码,使用我的api文件直接上传你的网站目录即可实现伪一次解析

<?php
header("Content-type: text/html; charset=utf-8"); 	
$url=$_GET['url'];
$api='https://jx.wslmf.com/api.php?tp=all&url='.$url;
$get=file_get_contents($api);
$t=str_replace("(","",$get);
$t=str_replace(");","",$t);
$json=json_decode($t,true);
?>
<!DOCTYPE html>
<html>
 <head>
    <title>流氓凡解析</title>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <meta http-equiv="content-language" content="zh-CN" />
    <meta http-equiv="X-UA-Compatible" content="chrome=1" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta name="referrer" content="never" />
    <meta name="renderer" content="webkit" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta name="HandheldFriendly" content="true" />
    <meta name="x5-page-mode" content="app" />
    <meta name="Viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <link rel="shortcut icon" href="data/images/logo.ico" type="image/icon"/>
	<script type="text/javascript" src="//www.ckplayer.tv/ccdao.js"></script>   
    <link rel="stylesheet" href="//cdn.btjson.com/dplayer/1.22.2/DPlayer.min.css" type="text/css" />
    <style type="text/css">*{margin: 0;padding: 0;font-family: "Microsoft YaHei",SimHei,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;}img{border: 0;}a{color:inherit;text-decoration: none;color:#4B7E9D;}a:hover{text-decoration: underline;}body{background:#000;padding: 0;margin: 0;width:100%;height:100%;color:#fff;overflow:hidden;cursor: default;}.error{position:absolute;width:100%;height:100%;text-align:center;top:50%;margin:-30px 0 0 0;z-index:10;}.player,#dpplayer{position:absolute;width:100%;height:100%;}.dplayer-menu{display:none !important;}.torrentnum{padding: 5px;position: absolute;font-size: 12px;}</style>
    <script type="text/javascript" src="//cdn.btjson.com/hlsjs/0.9.1/hls.min.js"></script>
    <script type="text/javascript" src="//cdn.btjson.com/dplayer/1.22.2/DPlayer.min.js"></script>
    <script type="text/javascript" src="//cdn.btjson.com/p2pjs/1.0/p2p.js"></script>
    <script type="text/javascript" src="//cdn.btjson.com/p2pjs/1.0/hls.plugin.js"></script>
    <script type="text/javascript">
    window.onload = function(){
        var dp = new DPlayer({
            container:document.getElementById('dpplayer'),
             autoplay:true,
			 video:{
                quality:[{
                    type:'hls',
                    name:'自动',
                    url:'<?php echo($json['url']);?>'
                }],
                defaultQuality:0
            }
        });
        dp.play();
    };
    </script>
    <body>
    <div id="dpplayer"></div>
    </body>
    </html>

http://你的域名/vip.php?url=,这就是你新的接口


[/hide_cv]

此教程仅为演示,可对其进行优化更新,不再继续赘述。不要尝试套用我接口的api文件哦,不信你可以试试!

温馨提示:尽可能的将js文件同步到本地来吧!

评论

精彩评论
  • 2021-07-07 23:21:38

    东莞政府部门发布

  • 2021-05-04 22:01:14

    进来来看按
    不知道怎么不

  • 2021-04-24 12:07:36

    博主,. js 和css没有了求补

  • 2021-04-04 09:50:52

    谢谢分享

  • 2020-10-18 17:46:35

    博主,. js 和css没有了求补

  • 2020-10-18 17:23:38

    api在哪呢看了半天

  • 2020-10-18 17:20:23

    我看看这个怎么样

  • 2020-02-07 01:26:24

    学习一下

  • 2020-01-31 22:00:03

    测试一下 试试可能很好

  • 2019-11-17 20:00:56

    学习一下。感谢分享

  • 2019-10-05 23:46:03

    [face_03] [face_17] [face_26] [face_26] [face_23] [face_23] [face_23]

1 2 3 4 尾页