Btjson博客 Btjson博客

QQ空间解析源码(参考)

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

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

<?php 
//1006_06e29b9e38374b909e5192dfea48a83c

function get_qzone_video($picKey){
    preg_match('#p_skey=(.*);#iU',COOKIE_QQ,$p_skey);
    preg_match('#uin=(.*);#iU',COOKIE_QQ,$uin);
    $tk = g_tk($p_skey[1]);
    $hostUin = str_replace("o0","",$uin[1]);
    $api = "https://h5.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/video_get_data?g_tk={$tk}&picKey={$picKey}&number=1&hostUin={$hostUin}&getMethod=3";
    $content = curl($api,COOKIE_QQ);
    $json = str_replace(");","",str_replace("_Callback(","",$content));
    $data = json_decode($json,true);
    if($data["code"]==0){
        foreach ($data["data"]["photos"] as $key => $value) {
            $fkey = $value["picKey"];
            if($fkey == $picKey){
                $vurl = $value["url"];
                $videoinfo["video"]["file"] = $vurl;
                $videoinfo["video"]["type"] = "video/mp4";
                return $videoinfo;
            }
        }
    }else{
        return GlobalBase::get_unknown_video();
    }
}
function get_qzone_all_video(){
    preg_match('#p_skey=(.*);#iU',COOKIE_QQ,$p_skey);
    preg_match('#uin=(.*);#iU',COOKIE_QQ,$uin);
    $tk = g_tk($p_skey[1]);
    $hostUin = str_replace("o0","",$uin[1]);
    $api = "https://h5.qzone.qq.com/proxy/domain/taotao.qq.com/cgi-bin/video_get_data?g_tk={$tk}&hostUin={$hostUin}&appid=4&getMethod=2&count=2000";
    $content = curl($api,COOKIE_QQ);
    $json = str_replace(");","",str_replace("_Callback(","",$content));
    $data = json_decode($json,true);
    if($data["code"]==0){
        foreach ($data["data"]["Videos"] as $key => $value) {
            $videos[$key]["vid"] = $value["vid"];
            $videos[$key]["pic"] = $value["pre"];
            $videos[$key]["title"] = $value["title"];
            $videos[$key]["url"] = $value["url"];
        }
    }
    return $videos;
}

function curl($url,$cookie="")
{
    $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["cookie"] = $cookie;
    $params["proxy"] = PROXY;//代理地址
    return GlobalBase::curl($url,$params);
}
function g_tk($data) {
    $t = 5381;
    $chars = str_split($data);
    for ($n = 0,$r = strlen($data); $n < $r; ++$n) {
        $t += intval32($t << 5) + ord($chars[$n]);
    }
    return $t & 2147483647;
}
function intval32($num) {
    $num = $num & 0xffffffff;
    $p = $num>>31;
    if($p==1) {
        $num = $num-1;
        $num = ~$num;
        $num = $num & 0xffffffff;
        return $num * -1;
    } else {
        return $num;
    }
} 
 ?>
jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

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

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

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