1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
| <?php header("Access-Control-Allow-Origin:*"); header('Content-type:application/json; charset=utf-8');
(isset($_GET['url']) && $_GET['url']) ? ($uurl = $_GET['url']) : exit(json_encode(["success" => false, "message" => "文件不存在"], JSON_UNESCAPED_UNICODE)); $_url = str_replace(['http://', 'https://'], '', $uurl);
$_keyArr = explode('/', $_url); $_key = end($_keyArr);
$BASEURL = 'https://_.lanzouq.com/';
$_res = getData($BASEURL . $_key);
preg_match_all('/user-name">(.*?)<\/span>/i', $_res, $_fileAutherArr); if ($_fileAutherArr[1]) { preg_match_all('/filenajax">(.*?)<\/div>/i', $_res, $_fileNameArr); preg_match_all('/n_file_infos">(.*?)<\/span>/i', $_res, $_fileInfoArr); preg_match_all('/大小:(.*?)<\/div>/i', $_res, $_fileSizeArr); if (count($_fileInfoArr[1]) > 1) { $__time = $_fileInfoArr[1][0]; $__type = $_fileInfoArr[1][1]; } else { $__time = '-'; $__type = $_fileInfoArr[1][0]; } $infoArr = [ 'name' => $_fileNameArr[1][0] ?? '-', 'auther' => $_fileAutherArr[1][0] ?? '-', 'time' => $__time ?? '-', 'size' => $_fileSizeArr[1][0] ?? '-', 'type' => $__type ?? '-' ]; } else { preg_match_all('/<title>(.*?) - 蓝奏云/i', $_res, $fileNameArr); preg_match_all('/span>(.*?)<br/i', $_res, $infoArr); preg_match_all('/font>(.*?)<\/font/i', $_res, $autherArr); $infoArr = [ 'name' => $fileNameArr[1][0] ?? '-', 'auther' => $autherArr[1][0] ?? '-', 'time' => $infoArr[1][1] ?? '-', 'size' => $infoArr[1][0] ?? '-', 'type' => $infoArr[1][3] ?? '-' ]; }
preg_match_all('/src="(.*?)" frameborder/i', $_res, $ifarmArr); $ifarmUrl = strlen($ifarmArr[1][0]) > 36 ? $ifarmArr[1][0] : $ifarmArr[1][1]; $_sres = getData($BASEURL . $ifarmUrl);
preg_match_all("/'(.*?)'/i", $_sres, $downKeyArr); preg_match_all("/ajaxdata = '(.*?)';/i", $_sres, $ajaxdata); preg_match_all("/websignkey = '(.*?)';/i", $_sres, $webKey); preg_match_all("/wsk_sign = '(.*?)';/i", $_sres, $webKeys);
$downKey = ''; foreach ($downKeyArr[1] as $v) { strlen($v) > 36 && ($downKey = $v); }
if ($downKey) { $datas = curlPosr($downKey, $ajaxdata[1][0], $webKey[1][0] ?? $webKeys[1][0], $BASEURL); $json = json_decode($datas, true); $result = array("success" => true, 'info' => $infoArr, "download" => $json['dom'] . "/file/" . $json['url'], "fileUrl" => restoreUrl($json['dom'] . "/file/" . $json['url'])); exit(json_encode($result, JSON_UNESCAPED_UNICODE)); } else { $result = array("success" => false, "message" => "文件不存在"); exit(json_encode($result, JSON_UNESCAPED_UNICODE)); }
function curlPosr($urls, $ajaxData, $webKey, $uname) { $ip = rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255); $header[] = "CLIENT-IP:" . $ip; $header[] = "X-FORWARDED-FOR:" . $ip; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "{$uname}ajaxm.php"); curl_setopt($ch, CURLOPT_REFERER, $uname . $urls); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); $data = array( "signs" => $ajaxData, "action" => "downprocess", "sign" => $urls, "websign" => '', "ves" => "1", "websignkey" => $webKey ); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $output = curl_exec($ch); curl_close($ch); return $output; }
function getData($url) { $ip = rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255); $header[] = "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"; $header[] = "accept-encoding: gzip, deflate, br"; $header[] = "accept-language: zh-CN,zh;q=0.9"; $header[] = "cache-control: max-age=0"; $header[] = "sec-ch-ua: \"Google Chrome\";v=\"95\", \"Chromium\";v=\"95\", \";Not A Brand\";v=\"99\""; $header[] = "sec-ch-ua-mobile: ?0"; $header[] = "sec-ch-ua-platform: \"Windows\""; $header[] = "sec-fetch-dest: document"; $header[] = "CLIENT-IP:" . $ip; $header[] = "X-FORWARDED-FOR:" . $ip; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_TIMEOUT, 5); $output = curl_exec($ch); curl_close($ch); return $output; }
function restoreUrl($shortUrl) { $ip = rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255) . '.' . rand(0, 255); $header[] = "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"; $header[] = "accept-encoding: gzip, deflate, br"; $header[] = "accept-language: zh-CN,zh;q=0.9"; $header[] = "cache-control: max-age=0"; $header[] = "sec-ch-ua: \"Google Chrome\";v=\"95\", \"Chromium\";v=\"95\", \";Not A Brand\";v=\"99\""; $header[] = "sec-ch-ua-mobile: ?0"; $header[] = "sec-ch-ua-platform: \"Windows\""; $header[] = "sec-fetch-dest: document"; $header[] = "CLIENT-IP:" . $ip; $header[] = "X-FORWARDED-FOR:" . $ip; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $shortUrl); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.0.0 Safari/537.36"); curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_exec($ch); $info = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL); curl_close($ch); return $info; }
|