蓝奏云解析源码PHP

发布时间:2019-10-13 21:36:45 热度: 1385 ℃ 评论数: 0

之前就写过蓝奏云的解析,稳定了一段时间,最近发现失效了,又重新修复了一下,把新的分享出来吧~

$id = isset($_GET['id']) ? $_GET['id'] : "";
$url = 'https://www.lanzous.com/'.$_GET['id'];
$pwd = isset($_GET['pwd']) ? $_GET['pwd'] : "";
$type = isset($_GET['type']) ? $_GET['type'] : "";
if (empty($url)) {
    die(
    json_encode(
        array(
            'code' => 400,
            'msg' => '请输入URL'
        )
        , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
    );
}
$softInfo = MloocCurlGet($url);
$softInfo = strtr($softInfo, array('' => ''));
if (strstr($softInfo, "文件取消分享了") != false) {
    die(
    json_encode(
        array(
            'code' => 400,
            'msg' => '文件取消分享了'
        )
        , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
    );
}
preg_match('~class="b">(.*?)<\/div>~', $softInfo, $softName);
if(!isset($softName[1])){
	preg_match('~
(.*?)
~', $softInfo, $softName); } if (strstr($softInfo, "手机Safari可在线安装") != false) { if(strstr($softInfo, "n_file_infos") != false){ $ipaInfo = MloocCurlGet($url, 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'); preg_match('~href="(.*?)" target="_blank" class="appa"~', $ipaInfo, $ipaDownUrl); }else{ preg_match('~com/(\w+)~', $url, $lanzouId); if (!isset($lanzouId[1])) { die( json_encode( array( 'code' => 400, 'msg' => '解析失败,获取不到文件ID' ) , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); } $lanzouId = $lanzouId[1]; $ipaInfo = MloocCurlGet("https://www.lanzous.com/tp/" . $lanzouId, 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1'); preg_match('~href="(.*?)" id="plist"~', $ipaInfo, $ipaDownUrl); } $ipaDownUrl = isset($ipaDownUrl[1]) ? $ipaDownUrl[1] : ""; if ($type != "down") { die( json_encode( array( 'code' => 200, 'msg' => '', 'name' => isset($softName[1]) ? $softName[1] : "", 'downUrl' => $ipaDownUrl ) , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); } else { header("Location:$ipaDownUrl"); die; } } preg_match("~iframe.*?name=\"[\s\S]*?\"\ssrc=\"\/(.*?)\"~", $softInfo, $link); //preg_match('|iframe class="ifr2" name="(.*?)" src="(.*?)"|',$softInfo,$link); $ifurl = "https://www.lanzous.com/" . $link[1]; $softInfo = MloocCurlGet($ifurl); if (empty($pwd) && strstr($softInfo, "输入密码") != false) { die( json_encode( array( 'code' => 400, 'msg' => '请输入分享密码' ) , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); } preg_match("~=\s'(.*?)';[\S\s]*?=\s'(.*?)'[\S\s]*?=\s'(.*?)'[\S\s]*?=\s'(.*?)'~", $softInfo, $segment); preg_match("|var sg = '(.*?)'|",$softInfo,$segment); $post_data = array( "action" => "downprocess", "sign" => $segment[1], "ves" => "1", ); $softInfo = MloocCurlPost($post_data, "https://www.lanzous.com/ajaxm.php", $ifurl); $softInfo = json_decode($softInfo, true); if ($softInfo['zt'] != 1) { die( json_encode( array( 'code' => 400, 'msg' => $softInfo['inf'] ) , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); } $downUrl = $softInfo['dom'] . '/file/' . $softInfo['url']; if ($type != "down") { die( json_encode( array( 'code' => 200, 'msg' => '', 'name' => isset($softName[1]) ? $softName[1] : "", 'downUrl' => $downUrl ) , JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) ); } else { // header("Location:$downUrl"); die; } function MloocCurlGet($url, $UserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36') { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); if ($UserAgent != "") { curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent); } #关闭SSL curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); #返回数据不直接显示 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($curl); curl_close($curl); return $response; } function MloocCurlPost($post_data, $url, $ifurl = '', $UserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36') { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent); if ($ifurl != '') { curl_setopt($curl, CURLOPT_REFERER, $ifurl); } #关闭SSL curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); #返回数据不直接显示 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data); $response = curl_exec($curl); curl_close($curl); return $response; }


输出结果:

{
    "code": 200,
    "msg": "",
    "name": "https://www toutiao com/a6750138907435745803/",
    "downUrl": "https://vip.d0.baidupan.com/file/?UDYCPAs6ATBTWgA4Cz4Ha1plADhX7gW3UuEA4AfoBqVUs1O+C+8OvlS6B9pX5VTeB9RVtlSdC7kL61rtVrFavlDqAsYLeAEvU2wAJgt5B2BaaQBpV20FWFI8AGIHZgY2VGRTMQthDm5UMwdnVzFUcwc7VSNUNgs4Czxaa1Y7WmtQYwJtC3ABJVN1AGsLbQc2WjEAPFcnBTdSbQApB2sGNlR7UzQLZQ5uVDYHZlcwVDMHbVVmVD0LPQs/Wj5WP1o+UGACZwswATFTNQBvC2gHMlozADxXbAVlUmwAPwc9BjdUZ1MqCywOM1RyB3dXdlQmBzhVIlRiC20LMVptVjNabVBhAmILYwFzU3EAPwsyB2NaZgA4VzkFMlJtADQHbQY/VGdTMgthDm1ULAd/VyVUMwcxVSdUNgs4CzlaZFY4Wm1QaAJnC2IBbVMxAHALKgd2WncAOFc5BTJSYwAyB20GNFRgUzELYA5rVCQHJFdqVCUHYFVkVDILJws+Wm9WOVp1UGECbQtnAXtTNwBkC2c="
}



蓝奏云解析,php源码

吐槽一下
  • 消灭零回复

手机扫码访问