Btjson博客 Btjson博客

乐视云解析源码

in 技术文章 read (1286) 文章转载请注明来源!
<?php
/**
 * 乐视视频
 *
 * 
 * @author     http://www.pohaier.com
 * @version    1.0
 * @data       2018-08-21 14:15:07
 *
 *
 * 严重警告:
 * 1、源码仅供学习交流使用。
 * 2、禁止用于危害官方利益的行为。
 * 3、禁止用于违反法律法规的行为。
 * 
 *
 */
error_reporting(0);
header('Content-type: text/json;charset=utf-8');
$ui = array();
foreach($_GET as $key => $value){
    $ui[$key] = trim($value);
}

function https_curl($url){
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
    return curl_exec($curl);
}

function lecloud($uuid,$vuid){
    $sign = md5("cfflashformatjsonran".time()."uu{$uuid}ver2.2vu{$vuid}2f9d6924b33a165a6d8b5d3d42f4f987");
    $v = json_decode(https_curl("api.letvcloud.com/gpc.php?cf=flash&format=json&ran=".time()."&uu={$uuid}&ver=2.2&vu={$vuid}&sign={$sign}"),true);
    $ltyp = array("low"=>"标清","high"=>"高清","super"=>"超清","yuanhua"=>"原画");
    foreach( $v['data']['video_info']['media'] as $l=>$row ){
        $f['mp4'][$ltyp[$l]] = base64_decode($row['play_url']['main_url']);
        $f['m3u8'][$ltyp[$l]] = str_replace("tss=no","tss=ios",base64_decode($row['play_url']['main_url']));
    }
    $data = array(
        'title' => $v['data']['video_info']['video_name'],
        'video' => $f,
    );
    if( $v['code']==0 ){
        $printr = array('status' => '200', 'msg' => 'success', 'data' => $data);
    }else{
        $printr = array('status' => '1001', 'msg' => 'ㄟ( ▔, ▔ )ㄏ,参数错误');
    }
    return $printr;
}

$_loc1_ = $ui['data'];
$_loc2_ = $ui['type'];//链接清晰度
$_loc0_ = $ui['format'];//输出格式 json or 直连
$dtype = $ui['dtype'];//直连格式
$_loc3_ = explode('|',$_loc1_);
$uu = explode(":",$_loc3_[0])[1];
$vu = explode(":",$_loc3_[1])[1];

$_loc4_ = array(
    'bq' => '标清',
    'gq' => '高清',
    'cq' => '超清',
    'yh' => '原画',
);

$_loc5_ = lecloud($uu,$vu);
$_loc6_ = $_loc5_['data'];
$_loc7_ = $_loc6_['video'];

switch( $_loc0_ ){
    case "json":
        if( $_loc5_['status'] == 200 ){
            $data = array(
                'title' => $_loc6_['title'],
                'video' => array(
                    'mp4' => $_loc7_['mp4'][$_loc4_[$_loc2_]],
                    'm3u8' => $_loc7_['m3u8'][$_loc4_[$_loc2_]],
                )
            );
            $printr = $data;
        }else{
            $printr = array('status' => '1001', 'msg' => 'ㄟ( ▔, ▔ )ㄏ,参数错误');
        }
        print_r( json_encode($printr) );
        exit;
    break;
    case "url":
        if( $dtype == 'mp4' ){
            $printr = $_loc7_['mp4'][$_loc4_[$_loc2_]];
        }elseif( $dtype == 'm3u8' ){
            $printr = $_loc7_['m3u8'][$_loc4_[$_loc2_]];
        }else{
            $printr = null;
        }
        print_r( header("location:".$printr) );
        exit;
    break;
    default:
        print_r(json_encode(array('status' => '1001', 'msg' => 'ㄟ( ▔, ▔ )ㄏ,参数错误')));
}

参数说明:

type=影片清晰度
format=输出格式 json or url直连跳转
dtype=影片格式 mp4 或 m3u8

实例:

https://www.pohaier.com/bcloud.php?data=uu:a3ce246289|vu:42be21a04c&type=bq&format=url&dtype=mp4

https://www.pohaier.com/bcloud.php?data=uu:a3ce246289|vu:42be21a04c&type=bq&format=url&dtype=m3u8
jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

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

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

技术文章
发表新评论
博客已萌萌哒运行
© 2019 由 Typecho 强力驱动.Theme by btjson
PREVIOUS NEXT
雷姆
拉姆