蓝奏云盘是国内少有的良心云盘,在某度疯狂限速到10kb的下载速度情况下,蓝奏100M内文件仍然不限速,用起来相当的爽。这么爽的云盘不用来搞直链简直浪费,于是网上的大神们隔三岔五就要解析一波蓝奏云,而蓝奏云被白嫖了这么多年居然还是不倒闭真的十分神奇!下面是某位不知名网友提供的蓝奏云盘PHP版直链解析代码,集成到博客中是相当的奈斯。

复制下面的代码,保存为XXX.php文件

<?php
//取出中间文本
function getSubstr($str, $leftStr, $rightStr)
{
$left = strpos($str, $leftStr);
//echo '左边:'.$left;
$right = strpos($str, $rightStr,$left);
//echo '<br>右边:'.$right;
if($left < 0 or $right < $left) return '';
return substr($str, $left + strlen($leftStr), $right-$left-strlen($leftStr));
}
//构造http请求
function http_get($url){
$oCurl = curl_init();
$user_agent = "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1";
if(stripos($url,"https://")!==FALSE){
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
}
curl_setopt($oCurl, CURLOPT_USERAGENT,$user_agent);
curl_setopt($oCurl, CURLOPT_URL, $url);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl);
curl_close($oCurl);
if(intval($aStatus["http_code"])==200){
return $sContent;
}else{
return false;
}
}
if(isset($_GET['url'])){
$web = http_get(str_replace("com/","com/tp/",$_GET['url']));
$domianload = getSubstr($web,"domianload = '","';");
$downloads = getSubstr($web,"downloads = '","';");
$url = $domianload.$downloads;
//直接下载使用下面这句
//header("Location: ".$url);
//显示下载链接使用下面这句
echo $url;
}
?>

 

使用方法

通过get方式传递url参数(下载地址),假如下载地址为 https://lz.com/xxxxx ,那么在浏览器中访问上面你保存的文件地址假设为 域名/down.php ,则解析地址为:

域名/down.php?url=https://lz.com/xxxxx

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注