微云网盘php解析源码_更新

作者:matrix 被围观: 27,478 次 发布时间:2014-01-06 分类:零零星星 | 142 条评论 »

这是一个创建于 3757 天前的主题,其中的信息可能已经有所发展或是发生改变。

应小伙伴的留言放出源码,并考虑多文件的情况。

这代码弄了好几天才搞出来的,100多行不容易。 🙄

本人菜鸟,代码上有问题的地方欢迎指正 互相学习!! 爱好php~

版本说明:

大于100MB,有提取密码的文件外链会失败。

放到BAE上不知道啥原因 总是403  503 错误,不过我在本地测试是成功的。其他未知
解决:

bae 403错误,正如Lostape所说,正则匹配的问题。
preg_match('|\.php\??\/(.*)\.\w+|',$_SERVER["REQUEST_URI"],$ur);
大部分的bae 503错误,应该是有太长的& or ?& 导致的。具体不详
更多BUG中~

使用说明:

微云:http://share.weiyun.com/eec279cd08578598b84e92403b3d5e99

普通下载:http://localHOST/weiyun.php/eec279cd08578598b84e92403b3d5e99.flv

BAE调用下载:http://ฏ๎๎๎๎๎๎๎๎๎ฏ ้้้ฏด้้้้้็็็็็้้้้้็็.duapp.com/t.php?/eec279cd08578598b84e92403b3d5e99.flv(尝试兼容bae)

http://ฏ๎๎๎๎๎๎๎๎๎ฏ ้้้ฏด้้้้้็็็็็้้้้้็็.duapp.com/t.php?u=eec279cd08578598b84e92403b3d5e99(再度尝试兼容bae)

技术问题,BAE上常出现503错误。不保证绝对可用,欢迎测试!!

 源码(已失效):

http://pan.baidu.com/s/1c05TCK4 #密码: kh0e(再度尝试兼容bae)
http://pan.baidu.com/s/1jGt6bSa #密码: t5t1 (尝试兼容bae)
http://pan.baidu.com/s/1EeYiq%20 #密码:32my

再来mp3测试:

源码

<?php
/**
 * 微云解析 V200115
 * Author:不懂就乱来
 * Website:https://www.hhtjim.com
 * 13-12-27 15:46 主体编写完成
 * 2014/1/5 添加多文件的情况
 * 2014/1/15 解决BAE上的503错误
 **/
error_reporting(0);
$ttim = 600; //使用前需要配置缓存时间:600毫秒 = 10分钟
preg_match('|\.php\??\/(.*)\.\w+|', $_SERVER["REQUEST_URI"], $ur);
if (!isset($ur) || $ur == null)
{
    exit('Please Check <a href="https://www.hhtjim.com/message-wall#comment">here.');
}
$url = 'http://share.weiyun.com/' . $ur[1];
$class = new weiyun();
$conpage = $class->curl_get($url);
preg_match('|var shareInfo = ({.*?});|', $conpage, $con_json);
if (!$con_json)
{
    exit('Please Check <a href="https://www.hhtjim.com/message-wall#comment">here.');
}
$obj = json_decode($con_json[1], true);
preg_match('|url\.cn\/(\w+)|', $obj['short_url'], $surl);
$zn = $obj['file_list'][0]['file_name'];
preg_match('|([\s\S]+)\.([^\.]+)$|', $zn, $type);
$sename = "wy-$surl[1]";
$name = $type ? $type[1] : 'HHTJIM.com_file';
$houzui = $type ? $type[2] : 'TMD什么文件';
preg_match('|(http:\/\/[^"]+ftn_handler[^"]+)\?fname=|', $class->curl_get($url), $res);
if ($res)
{
    $dl[0] = $res[1] . '?&fname=' . $name . time() . '.' . $houzui;
}
else
{
    session_id($sename);
    session_start();
    parse_str($_SESSION[$sename], $info);
    if ($_SESSION[$sename] && $info['times'] + $ttim > time())
    {
        if (strpos($_SESSION[$sename], 'qq.com:443')) // 若匹配到多文件打包
        {
            $dl = explode('/?&', $_SESSION[$sename]);//解决BAE上的503错误
        }
        else
        {
            $dl = explode('&', $_SESSION[$sename] . '&fname=' . $name . time() . '.' . $houzui);
        }
    }elseif ($_SESSION[$sename] && $info['times'] + $ttim <= time())
    {
        if (strpos($class->get_wy_dl($url), 'qq.com:443'))
        {
            $dl = explode('/?&', $class->get_wy_dl($url));
        }
        else
        {
            $dl = explode('&', $class->get_wy_dl($url)) ;
        }
    }elseif (emptyempty($_SESSION[$sename]))
    {
        if (strpos($class->get_wy_dl($url), 'qq.com:443'))
        {
            $dl = explode('/?&', $class->get_wy_dl($url));
        }
        else
        {
            $dl = explode('&', $class->get_wy_dl($url)) ;
        }
    }
}
header("Location: " . $dl[0]);
class weiyun
{
    var $url;
    public function get_wy_dl($url)
    {
        $conpage = $this->curl_get($url);
        preg_match('|var shareInfo = ({.*?});|', $conpage, $con_json);
        $obj = json_decode($con_json[1], true);
        preg_match('|url\.cn\/(\w+)|', $obj['short_url'], $surl);
        $sename = "wy-$surl[1]";
        $conpage = $this->curl_get($url);
        preg_match('|var shareInfo = ({.*?});|', $conpage, $con_json);
        $this->url = $url;
        $zn = $obj['file_list'][0]['file_name'];
        preg_match('|([\s\S]+)\.([^\.]+)$|', $zn, $type);
        $name = $type ? $type[1] : 'HHTjim.Com_file';
        $houzui = $type ? $type[2] : 'TMD什么文件';
        $obj_fid = json_decode($con_json[1]); //多文件的情况
        $fidarry = $obj_fid->file_list;
        foreach ($fidarry as $fids)
        {
            $fid[] = $fids->file_id;
        }
        $fid = implode(',', $fid);
        $pdir = $obj['pdir_key'];
        $sharekey = $obj['share_key'];
        $dlskey = $obj['dlskey'];
        $uin = $obj['uin'];
        $lurl = "http://web.cgi.weiyun.com/share_dl.fcg?browser=mozilla&dir=&fid=$fid&os_info=windows&pdir=$pdir&sharekey=$sharekey&skey=&uin=$uin&ver=12&zn=" . time(); //修复BUG:CURL时&zn(文件名)参数后面出现阿拉伯文会400 bad错误
        $header[] = "Cookie: dlskey=$dlskey";
        $header[] = "Referer: " . $this->url;
        $header[] = "User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:26.0) Gecko/20100101 Firefox/26.0";
        $rt = $this->curl_get($lurl, null, null, null, null, $header);
        preg_match('|Location: (.*)(\?fname=)?|', $rt, $do);
        if ($do)
        {
            if (strpos($do[1], 'qq.com:443')) // 若匹配到多文件打包,则输出,加缓存探针
            {
                $dl = $do[1] . '/?&times=' . time();
                $_SESSION[$sename] = $dl;
                return $dl;
            }
            else
            {
                $dl = $do[1] . '?&times=' . time();
                $_SESSION[$sename] = $dl;
                return $dl . '&fname=' . $name . time() . '.' . $houzui;
            }
        }
        else // 外链失败,跳转到微云文件URL
        {
            unset($_SESSION[$sename]);
            return $this->url;
        }
    }
    public function curl_get($url, $post = false, $carry_header = true, $REFERER_ = false, $useragent = false, $add_arry_header = null)
    {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HEADER, 1);
        if ($carry_header)
        {
            curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent:Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16'));
        }
        if ($add_arry_header)
        {
            curl_setopt($ch, CURLOPT_HTTPHEADER, $add_arry_header);
        }
        if ($post)
        {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }
        if ($REFERER_)
        {
            curl_setopt($ch, CURLOPT_REFERER, $REFERER_);
        }
        if ($useragent)
        {
            curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $get_url = curl_exec($ch);
        curl_close($ch);
        return $get_url;
    }
}
?>
其他文章:
本文固定链接:https://www.hhtjim.com/micro-cloud-network-disk-update-php-source-code-analysis.html
matrix
本文章由 matrix 于2014年01月06日发布在零零星星分类下,目前没有通告,你可以至底部留下评论。
转载请注明:微云网盘php解析源码_更新-HHTjim'S 部落格
关键字:, , , ,

有142 条评论 »

  1. ziyang ziyang 2016-11-16 16:47:26 +0800#110

    看看啊怎么搞的

  2. wangwang wangwang 2016-11-14 12:39:09 +0800#109

    😛

  3. jack jack 2016-11-13 14:10:16 +0800#108

    还能用吗? ❓

  4. 哇哈哈 哇哈哈 2016-11-9 22:16:05 +0800#107

    来看看支持下

  5. 之前 之前 2016-11-8 15:21:02 +0800#106

    🙂

  6. fdd fdd 2016-9-6 13:39:03 +0800#105

    ❗ 😎 😈 ➡

  7. 小海 小海 2016-7-28 17:38:26 +0800#104

    不是有的伙伴说测试可用吗,怎么不行

  8. asdasd asdasd 2016-7-26 16:58:32 +0800#103

    😛 😛 😛 😛 😛 😛

  9. ad ad 2016-7-26 16:53:25 +0800#102

    😛 😛 😛 😛 😛 😛 😛 😛

  10. 小海 小海 2016-7-17 16:30:35 +0800#101

    还能用吗

1 9 10 11

添加新评论 »

 🙈 😱 😂 😛 😭 😳 😀 😆 👿 😉 😯 😮 😕 😎 😐 😥 😡 😈 💡

插入图片

NOTICE: You should type some Chinese word (like “你好”) in your comment to pass the spam-check, thanks for your patience!