微云网盘外链php源码-LMLPHP

微云网盘的10TB空间也要全部利用起来。

申明:此页面的源码已失效,走这里查看最新>>微云网盘php解析源码_更新

外链转换工具:http://link.hhtjim.com/

代码来自破博客

<?php
//提取微云分享地址
preg_match('|\/.+\/(\w+)|', $_SERVER['REQUEST_URI'], $res);
$key = $res ? $res[1] : exit("weiyun URL error!");
$url = $referer = "http://share.weiyun.com/$key";
$useragent = "BlackBerry/3.6.0";

//匹配出下载地址
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$src = curl_exec($curl);
curl_close($curl);
preg_match('|http://.+sharekey[^"]+|', $src, $res);
$url = $res ? $res[0] : exit("weiyun URL error! Not find weiyun code!");

//伪造referer,获取返回的响应头信息
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_REFERER, $referer);
curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$src = curl_exec($curl);
curl_close($curl);

//从响应信息头匹配出真实的文件地址并下载
preg_match('|Location: (.+)\r|', $src, $res);
$songurl = $res ? $res[1] : exit("Can not get WeiYun Download url!");
header("Location: $songurl");
//echo $songurl;
?>

这种方法该不错滴。

使用示例:http://XXX.php/微云URL

http://share.weiyun.com/b500a423288e8d0095d49657fe21438b

外链测试:http://link.hhtjim.com/wy/b500a423288e8d0095d49657fe21438b/逆战-张杰.mp3

另外一种方法,已失效

<?php

    function curl_get($url,$post=false,$carry_ua=true){
        $ch=curl_init($url);
        if($carry_ua){
            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 ($post) {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        }
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $get_url = curl_exec($ch);
        curl_close($ch);
        return $get_url;
    }


//echo curl_get("http://share.weiyun.com/ff731c8d95191ba06396bccde03b28b3");

$contentS = curl_get($_GET['url']);
if($_GET['url']){
  $content = curl_get($_GET['url']);
}else{
    echo '请加上地址';
}
if(preg_match('|var shareInfo = (.*)\;|',$content,$ar)){
  $content = json_decode($ar[1]);
  // var_dump($content);

  $uin = $content->uin;
  $dl_svr_host = $content->dl_svr_host;
      $dl_svr_port = $content->dl_svr_port ;
    // $file_name = $content->file_name;
preg_match('|<h3 class="ui-title">(.*?\.\w+)<\/h3>|',$contentS,$getfilena);
$file_nam = ''.$getfilena[1];
    // $file_nam = $getfilena[1] ? $getfilena[1] : exit("Can not get file name!");
      $dl_encrypt_url = $content->dl_encrypt_url;
  $value = 'http://'.$dl_svr_host.':'.$dl_svr_port.'/ftn_handler/'.$dl_encrypt_url.'/?fname='.$file_nam;
//header("location:$value");
echo $value;
}
?>

优化过抓取代码,也是依照官方的下载地址做的。最终取得的下载地址貌似没用,打不开

失效,只做记录。

参考:http://bbs.cenfun.com/thread-22373-1-1.html


12-12 更新(已失效):

说明:以下代码取自外链转换工具,目前实测可用~
调用说明:http://XXX.php?u=微云URL
http://127.0.0.1/WY.php?u=http://share.weiyun.com/b500a423288e8d0095d49657fe21438b

<?php
error_reporting(0);//禁用错误报告
  function curl_get($url,$post=false,$carry_header=true,$REFERER_=false,$useragent=false,$add_arry_header=null){
        $ch=curl_init($url);

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

    function curl_get_http($url,$REFERER_,$add_arry_header=null){
  $curl = curl_init($url);

curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if($REFERER_){curl_setopt($curl, CURLOPT_REFERER,$REFERER_);}
if($add_arry_header){
            curl_setopt($curl, CURLOPT_HTTPHEADER, $add_arry_header);
        }
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$src = curl_exec($curl);
curl_close($curl);
return $src ;
}
if(isset($_GET['u'])){//微云下载
preg_match('|share\.weiyun\.com\/(\w+)|', $_GET['u'], $res);
$wykey = $res ? $res[1] : exit('weiyun URL error!Please Check <a href="https://www.hhtjim.com/message-wall">here</a> ');
$url = $referer = "http://share.weiyun.com/$wykey";
$src = curl_get($url);
preg_match('|http://.+ftn_handler[^"]+|', $src, $res);
preg_match('|\"dlskey\":\"(\w+)\"|', $src, $dlskey);//若失败尝试发送cookies头
$header[]= "Cookie: dlskey=$dlskey[1]";
$header[]= 'User-Agent: 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($res){
header("Location: $res[0]");
}else{
preg_match('|http://.+sharekey[^"]+|', $src, $res);
$url = $res ? $res[0] : exit("Not find weiyun code!");
$src = curl_get_http($url,$referer,$header);
echo $url;
preg_match('|Location: (.+)\r|', $src, $res);

$wy_songurl = $res ? $res[1] : exit('Please Check <a href="https://www.hhtjim.com/message-wall">here</a> .');
header("Location: $wy_songurl");
}
}


?>
03-04 15:09