解析158网盘直连的代码
158网盘直连解析代码是一种用于获取158网盘资源链接的代码。它可以通过输入158网盘的资源ID,直接获取到该资源的下载链接。这种代码通常使用Python编写,可以方便地在各种平台上运行。例如,你可以使用Python的requests库来发送HTTP请求,获取到158网盘的资源链接。然后,你可以将这个链接复制到浏览器中,就可以直接下载158网盘的资源了。这种方法比传统的通过浏览器访问158网盘的方式更加快捷和方便。
API代码
<?php/***@package158Pan*@authorAndy*@version1.2.0*@linkhttps://lsland.cn*///指定允许其他域名访问header('Access-Control-Allow-Origin:*');header('content-type:application/json;charset:utf-8');functionobject_array($array){if(is_object($array)){$array=(array)$array;}if(is_array($array)){foreach($arrayas$key=>$value){$array[$key]=object_array($value);}}return$array;}functionCurl_Post($id){$data='js={"appid":307,"avs":2,"bdb":0,"getlist":{"avs":2,"bdb":0,"c1":1,"inslog":"","proc":[{"id":"1"},{"id":"3"}],"reg":[{"id":714},{"id":848},{"id":894}],"reg2":[441,459,26282,29600,33143,18920,33144],"vm":0},"id":2052,"md5":"67b7a4442c20658c67819f5fda9559ba","msoft":"IU-斑马,斑马@307_251892.exe","sid":'.$id.',"st":0,"uid":"1aeccea753321c903309ee4943657276","ver":"4.0.0.1126","vm":0,"zn":8}';$UserAgent='Mozilla/5.0(compatible;MSIE9.0;WindowsNT6.1;WOW64;Trident/5.0)';#设置UserAgent$curl=curl_init();curl_setopt($curl,CURLOPT_URL,"https://x.93ne.com/qy/gi");//关闭SSL表示不检查证书curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,false);curl_setopt($curl,CURLOPT_SSL_VERIFYHOST,false);curl_setopt($curl,CURLOPT_USERAGENT,$UserAgent);curl_setopt($curl,CURLOPT_HEADER,0);//启用时会将头文件的信息作为数据流输出。这里不启用curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);//如果成功只将结果返回,不自动输出任何内容。如果失败返回FALSEcurl_setopt($curl,CURLOPT_POST,1);//如果你想PHP去做一个正规的HTTPPOST,设置这个选项为一个非零值。这个POST是普通的application/x-www-from-urlencoded类型,多数被HTML表单使用。curl_setopt($curl,CURLOPT_POSTFIELDS,$data);//需要POST的数据curl_setopt($curl,CURLOPT_HTTPHEADER,array("application/x-www-form-urlencoded","Content-length:".strlen($data)));$rtn=curl_exec($curl);if(!curl_errno($curl)){return$rtn;}else{echo'Curlerror:'.curl_error($curl);}curl_close($curl);}$type=isset($_GET['type'])?$_GET['type']:"";if(!empty($_GET['id'])){$id=$_GET['id'];$result=json_decode(Curl_Post($id));$result=object_array($result);$downUrl=$result["main"]["descr_downurl"];if($type!="down"){die(json_encode(array('code'=>200,'msg'=>'此API仅供于学习!','name'=>$result["main"]["descr_name"],'downUrl'=>$downUrl),JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));}else{header("Location:$downUrl");die;}}else{$result_url=str_replace("index.php","",$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?id=251892");echo'演示:'.$result_url;}?>
使用方法
?id=
示例:https://www.caijicaiji.com/158/?id=251892
文档:https://www.caijicaiji.com/158/api.php