腾讯获取视频VID

技术文章 腾讯解析 腾讯算法 腾讯解析源码 2018-04-13 阅读:3366
$_loc1_ = explode("/",$url);
if( strpos($url,"v.qq.com/x/cover") > 0 ){
    if( $_loc1_[6] ){
        $_loc2_ = explode(".",$_loc1_[6])[0];
        $data['vid'] = $_loc2_;
    }else{
        $_loc3_ = https_curl($url);
        preg_match("|<link rel=\"canonical\" href=\"([^(\}>)]+)\" />|",$_loc3_,$_loc4_);
        $_loc5_ = explode("/",$_loc4_[1]);
        $_loc6_ = explode(".",$_loc5_[6])[0];
        $data['vid'] = $_loc6_;
    }
}else if( strpos($url,"v.qq.com/x/page") > 0 ){
    if( $_loc1_[5] ){
        $_loc7_ = explode(".",$_loc1_[5])[0];
        $data['vid'] = $_loc7_;
    }else{
        $_loc8_ = https_curl($url);
        preg_match("|<link rel=\"canonical\" href=\"([^(\}>)]+)\" />|",$_loc8_,$_loc9_);
        $_loc10_ = explode("/",$_loc9_[1]);
        $_loc11_ = explode(".",$_loc10_[6])[0];
        $data['vid'] = $_loc11_;
    }
}
print_r($data);
版权声明

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

2条评论

    blonde

    As the admin of this website is working, no doubt very quickly it will be renowned, due to its feature contents.

    游客 Linux 623 天前回复

      admin
      @blonde

      Thank you, Yoshikazu.

      作者 Windows7 621 天前回复