Btjson博客 Btjson博客

歪歪神曲解析源码(参考)

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

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

<?php
//$url = "http://www.yy.com/x/15012_1222559164_38974734_1527084874496";
//$url = "http://www.yy.com/sv/9221285915528344768";
//$url = "http://www.yy.com/shenqu/play/id_1134094401301923854.html";
// $api = http://api-tinyvideo-web.yy.com/tinyVideo/getDetailsForVideo?appId=svwebpc&sign=&data=%7B%22resid%22%3A%229180350519213102625%22%2C%22uid%22%3A1%7D&_=1527172814634
echo json_encode(YY::parse($url));
/**
* 
*/
class YY
{
    public static function parse($url)
    {
        $content = self::curl($url);

        if(strstr($url,"/shenqu/play/")==true){
            preg_match('#snapshot":"(.*)","conv#',$content,$img);
            preg_match('#worksUrl":"(.*)","likeCou#',$content,$vurl);
            preg_match('#worksName":"(.*).","singerPho#',$content,$name);
           // print_r('1:'.$name);exit;
            $pic = "http:".$img[1];
            $type = 'h5mp4';
        }else if(strstr($url,"/sv/")==true){
            preg_match('#window.resid = \'(.*)\';#',$content,$id);
            preg_match('#window.owneruid = \'(.*)\';#',$content,$uid);

            $url = "http://api-tinyvideo-web.yy.com/tinyVideo/getDetailsForVideo?appId=svwebpc&sign=&data=%7B%22resid%22%3A%22".$id['1']."%22%2C%22uid%22%3A1%7D&_=".GlobalBase::getMillisecond();
            $data = self::curl($url,'http://www.yy.com/sv/'.$id['1']);
            $data = json_decode($data,true);
            $data = $data['data']['data'];
            $vurl['1'] = $data['resurl'];
            $pic = $data['snapshoturl'];
            $type = 'h5mp4';
            //print_r($data);exit;

        }else if(strstr($url,"/x/")==true){
            preg_match('#video:\s{0,}"(.*)",#',$content,$vurl);
            preg_match('#title:\s{0,}"(.*)",#',$content,$name);
            preg_match('#pic:\s{0,}"(.*)",#',$content,$img);
            //print_r('3:'.$name);exit;
            $pic = $img[1];
            $type = 'hls';
        }

        $mp4 =  str_replace('\u002F','/',$vurl[1]);
        $videoinfo['code'] = 200;
        $videoinfo["poster"]= $pic;
        $videoinfo['play'] = $type;
        $videoinfo["data"]["url"] = $mp4;
        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";
        if ($ref) {
            $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/141.html (转载时请注明本文出处及文章链接)

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