蓝奏云网盘直链解析PHP源码

仅提供PHP代码,具体用途自行适配。

仅供学习参考,AE博客不对此承担任何责任。

<?php
echo urlpoi('https://lanzoui.com/i9t47cb');
function urlpoi($downurl){
    $downarr = parse_url($downurl);
    $content = get_curl($downurl, 0, $downurl, 0, 1);
    preg_match_all('/iframe(.*?)src="(.*?)" /', $content, $lanzouy);
    
    if (strpos($output,'文件取消分享了') || empty($content)) {
        $download = 200;//文件取消分享了
    } elseif (strpos($output,'输入密码')) {
        $download = 201;//文件需要密码
    } elseif (empty($lanzouy[2][1])) {
        $download = 200;//文件需要密码
    } else {
        $content = get_curl($downarr['scheme'] . '://' . $downarr['host'] . $lanzouy[2][1], 0, $downurl, 'codelen=1; pc_ad1=1;', 1);
        preg_match('/var wsk_sign = \'(.*?)\';/', $content, $wsk_sign);
        preg_match('/var ws_sign = \'(.*?)\';/', $content, $ws_sign);
        preg_match('/var ajaxdata = \'(.*?)\';/', $content, $ajaxdata);
        preg_match('/sign\':\'(.*?)\'/', $content, $sign);
    
        $content = get_curl(
            $downarr['scheme'] . '://' . $downarr['host'] . '/' . 'ajaxm.php'
            , 'action=downprocess&signs=' . urlencode($ajaxdata[1]) . '&sign=' . $sign[1] . '&websign=' . $ws_sign[1] . '&websignkey=' . $wsk_sign[1] . '&ves=1'
            , $downarr['scheme'] . '://' . $downarr['host'] . $lanzouy[2][1]
            , 'codelen=1; pc_ad1=1;'
            , 0
            , 0
            , 0
            , ['Content-Type: application/x-www-form-urlencoded']
        );
        $array = json_decode($content);
        $download = $array->dom . '/file/' . $array->url;
    }
    return $download;
}

function get_curl($url,$post=0,$referer=1,$cookie=0,$header=0,$ua=0,$nobaody=0,$addheader=0)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    $httpheader[] = "Accept: application/json";
    //$httpheader[] = "Accept-Encoding: gzip,deflate,sdch";
    $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
    $httpheader[] = "Connection: close";
    if($addheader){
        $httpheader = array_merge($httpheader, $addheader);
    }
    curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
    if($post){
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    if($header){
        curl_setopt($ch, CURLOPT_HEADER, TRUE);
    }
    if($cookie){
        curl_setopt($ch, CURLOPT_COOKIE, $cookie);
    }
    if($referer){
        if($referer==1){
            curl_setopt($ch, CURLOPT_REFERER, 'http://m.qzone.com/infocenter?g_f=');
        }else{
            curl_setopt($ch, CURLOPT_REFERER, $referer);
        }
    }
    if($ua){
        curl_setopt($ch, CURLOPT_USERAGENT,$ua);
    }else{
        curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36');
    }
    if($nobaody){
        curl_setopt($ch, CURLOPT_NOBODY,1);
    }
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    curl_setopt($ch, CURLOPT_ENCODING, "gzip");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $ret = curl_exec($ch);
    curl_close($ch);
    //$ret=mb_convert_encoding($ret, "UTF-8", "UTF-8");
    return $ret;
}

转载请注明出处 AE博客|墨渊 » 蓝奏云网盘直链解析PHP源码

发表评论

路人甲

网友评论(2)

蓝奏云网盘直链啊这个如果能稳定使用,那特别棒啊,虽然只能上传一百M小文件,好处是无限容量。
米娜娜网 1年前 (2023-07-13) 回复
@米娜娜网:这东西只能是临时用用,正式用还是选择其他方式把。
墨渊 1年前 (2023-07-14) 回复