芒果TV云视频解析

<?php
/*

调试方法[仅支持芒果TV免费视频]:
[输出MP4] php?url=http://www.mgtv.com/b/317619/4070323.html
[输出M3U] php?url=http://www.mgtv.com/b/317619/4070323.html&type=m3u8

*/
error_reporting(0);
header('Content-Type: application/json;charset=UTF-8');
extract($_GET);
$url_ = 'url_';$json_ = 'json_';$sk_ = 'sk_';$vb_ = 'vb_';$fmt_ = '&fmt=4';"${$url_()}";
function sk_($url){
        $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B137 Safari/601.1');
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('X-FORWARDED-FOR:'.$_SERVER["REMOTE_ADDR"], 'CLIENT-IP:'.$_SERVER["REMOTE_ADDR"]));
        curl_setopt($curl, CURLOPT_REFERER, '');
        $Appfu_ = curl_exec($curl);
    curl_close($curl);
        $vb_ = &$GLOBALS['vb_'];
        return "${$vb_($Appfu_)}";
}
function url_(){
        $url = &$GLOBALS['url'];
        $url ? $url : exit('URL缺失');
        preg_match('|/([0-9]+)/([0-9]+)|i', $url, $did);
        $api = 'http://mdata.api.mgtv.com/remaster/uc/getSource?t='.time().'&abroad=0&partId='.$did[2].'&clipId='.$did[1].'';
        $json_ = &$GLOBALS['json_'];
        return "${$json_($api)}";
}
function vb_($zfc){
        $fmt_ = &$GLOBALS['fmt_'];
        $type_ = &$GLOBALS['type'];
        $hxy = 'http://disp.titan.mgtv.com';
        $jk = json_decode($zfc)->data->stream;
        if ($type_=='m3u8'){
                $Uappfu = $hxy.$jk->m3u8Url[0];
        }else{
                $Uappfu = $hxy.$jk->mp4Url[0];
        }
        $appfu = $Uappfu.$fmt_;
        header('location:'.$appfu);
        exit();
}
function json_($api_){
        $sk_ = &$GLOBALS['sk_'];
        return "${$sk_($api_)}";
}
?>
阿强爱分享
  • 本文由 发表于 2018年9月14日16:37:18
  • 转载请务必保留本文链接:https://iooqp.cn/154.html
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: