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

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

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

<?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;
}

 

上一篇 PC网易云音乐v2.10.11.201538绿化版
下一篇 WordPress ChatGPT 对话插件 WP-ChatGPT
文章列表
1 Excel转word小工具
Excel转word小工具
2
Fresh-久别重逢V3.0
Fresh-久别重逢V3.0
3
一度电,我们可以做什么?
一度电,我们可以做什么?
4
PC网易云音乐v2.10.11.201538绿化版
PC网易云音乐v2.10.11.201538绿化版
5
jsDelivr NPM CDN 国内加速节点
jsDelivr NPM CDN 国内加速节点
大米酱

大米酱管理员

三百六十行,行行出BUG。

本月创作热力图

最新评论
学习一下
学习一下
6月29日
学习一下
ziaowan
ziaowan
6月11日
OK
ziaowan
ziaowan
6月8日
阿洋
阿洋
6月2日
感谢作者分享
2067608730
2067608730
4月11日
加油大米!quantou
评论于APINEXT