Btjson博客 Btjson博客

27盘解析源码(参考)

in 技术文章 read (2005) 文章转载请注明来源!

只提供参考,自行测试更多资源交流群516722628

<?php 

if(strstr($url,"27pan")==true){
    echo json_encode(PAN27::parse($url));
}else{
    echo json_encode(PAN27::get_video($url));
}
/**
* 
*/
class PAN27
{

    public static function parse($url)
    {
        if(strstr($url,"36cj.com")==true){
            $api = $url;
        }else{
            $api = "http://api2.my230.com/?vid=$url";
        }
        $html = self::curl($api,$api);
        preg_match("#src='(.*?)'#",$html,$_surl);
        //print_r($api);exit;
        if(!empty($_surl[1])){
            $surl = GlobalBase::is_https().str_replace("//","",$_surl[1]);
            return self::get_video($surl,$url);
        }
    }
    public static function get_video($url,$u=""){
        $base = parse_url($url);
        $base["scheme"] = $base["scheme"] == ''? GlobalBase::is_https() : $base["scheme"].'://';
        $port = isset($base["port"])?":".$base["port"]:"";
        $host = $base["scheme"].$base["host"].$port;

        if(strstr($u,"27pan")==true){

            $content = self::curl($url);

            preg_match('#main\s*=\s*"(.*?)";#',$content,$_vurl);

            if (!isset($_vurl[1])) {
                preg_match('#m3u8Url\s*=\s*"(.*?)";#',$content,$_vurl);
                preg_match('#picUrl\s*=\s*"(.*?)";#',$content,$_pic);
            }

            //print_r($host.$_vurl[1]);exit;

            $videoinfo['code'] = 200;
            $videoinfo["data"]["url"] = "./m3u8.php?url=".str_replace("http://","https://",$host.$_vurl[1]);
            $videoinfo["data"]["poster"] = $host.$_pic[1];

            $videoinfo["play"] = "iframe";
            return $videoinfo;

        }elseif(strstr($url,"suyunbo")==true||strstr($url,"yongjiujiexi")==true||strstr($url,"512wx")==true||strstr($url,"bwzybf")==true||strstr($url,"bobo.kkpp")==true||strstr($url,"jsyunbf")==true||strstr($url,"cdn2-youku")==true||strstr($url,"com-bilibili")==true||strstr($url,"xw0371.com")==true){

            $content = self::curl($url,$url);
            preg_match('#main\s*=\s*"(.*?)";#',$content,$_vurl);
            preg_match('#url:\s*\'(.*?)\'#',$content,$_vurl1);

            if(empty($_vurl[1]) && empty($_vurl1[1]) ){
                preg_match('#requestToken\s*=\s*"(.*?)";#',$content,$_token);
                $data = file_get_contents($host."/token/".$_token[1]);
                $json = json_decode($data,true);
                $vurl = $host.$json["main"];
            }else{
                $a1 = isset($_vurl[1]) ? $_vurl[1] : $_vurl1[1];
                $vurl = $host.$a1;
            }
            $videoinfo['code'] = 200;
            $videoinfo["data"]["url"] = $vurl;
            $videoinfo["play"] = "hls";
            return $videoinfo;
        } else {
            $content = self::curl($url,$url);
            preg_match('#main\s*=\s*"(.*?)";#',$content,$_vurl);
            preg_match('#url:\s*\'(.*?)\'#',$content,$_vurl1);

            if(empty($_vurl[1]) && empty($_vurl1[1]) ){
                preg_match('#requestToken\s*=\s*"(.*?)";#',$content,$_token);
                $data = file_get_contents($host."/token/".$_token[1]);
                $json = json_decode($data,true);
                $vurl = $host.$json["main"];
            }else{
                $a1 = isset($_vurl[1]) ? $_vurl[1] : $_vurl1[1];
                $vurl = $host.$a1;
            }
            $videoinfo['code'] = 200;
            $videoinfo["data"]["url"] = $vurl;
            $videoinfo["play"] = "hls";
            return $videoinfo;
        }

    }

    public static function curl($url,$ref='')
    {
        $params["ua"] = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36";
        $params['ref'] = $ref;
        return GlobalBase::curl($url,$params);
    }
}
 ?>
jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

本文基于《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
文章链接:https://www.pohaier.com/2018/12/04/137.html (转载时请注明本文出处及文章链接)

技术文章
发表新评论
仅有 1 条评论
  1. 垃圾
    垃圾 7Chrome 71
    回复

    垃圾,毛都不懂

博客已萌萌哒运行
© 2019 由 Typecho 强力驱动.Theme by btjson
PREVIOUS NEXT
雷姆
拉姆