有时候,我们会调用一下视频站的视频,比如腾讯视频,但是因为腾讯视频带广告你懂的,所以百度上很多解析腾讯视频的方法,为此我也弄了一个自用的方法,现在公布代码

先说在前面,不支持VIP视频,咱不能动了腾讯视频的赖以生存的蛋糕!

function get_qq_video($url){
    $vcontent ='';
    preg_match('/https\:\/\/v.qq.com\/x\/(\S*)\/(\S*)\.html/',$url,$matches);
    if($matches){
        $vids=$matches[2];
        $videoUrl= get_qq_url($vids);
    }
    return '<video src="'.$videoUrl.'" poster="https://puui.qpic.cn/vpic_cover/'.$vids.'/'.$vids.'_hz.jpg/1280webp" controls="controls" width="100%"></video>';
}
function get_qq_url($vid){
    $url = 'https://vv.video.qq.com/getinfo?vids='.$vid.'&platform=101001&charge=0&otype=json';
    $json = file_get_contents($url);
    preg_match('/^QZOutputJson=(.*?);$/',$json,$json2);
    $tempStr = json_decode($json2[1],true);
    $vurl = 'https://ugcsjy.qq.com/'.$tempStr['vl']['vi'][0]['fn']."?vkey=".$tempStr['vl']['vi'][0]['fvkey'];
    return $vurl;
}

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。