前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >微云网盘外链php源码

微云网盘外链php源码

作者头像
HHTjim 部落格
发布2022-09-26 11:28:24
2.2K0
发布2022-09-26 11:28:24
举报
文章被收录于专栏:HHTjim'S 部落格

微云网盘外链php源码

作者:matrix 被围观: 154,090 次 发布时间:2013-10-26 分类:兼容并蓄 零零星星 | 16 条评论 »

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

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

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

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

代码来自破博客

代码语言:javascript
复制
<?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](https://www.hhtjim.com/tag/php)/[微云](https://www.hhtjim.com/tag/%e5%be%ae%e4%ba%91)URL

http://share.weiyun.com/b500a423288e8d0095d49657fe21438b

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

另外一种方法,已失效

代码语言:javascript
复制
<?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

代码语言:javascript
复制
<?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");  
}  
}  


?>
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 微云网盘外链php源码
  • 外链转换工具:http://link.hhtjim.com/
    • 另外一种方法,已失效。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档