嘟嘟社区

123盘貌似可以直接获取直链


本帖最后由 zhongziso 于 2022-9-7 10:13 编辑

只需要获取到文件信息的json参数以及Authorization授权就好了,连cookie都不需要。

接口代码如下:

  1. <?php
  2. $ch = curl_init();
  3. curl_setopt($ch, CURLOPT_URL, ‘https://www.123pan.com/b/api/file/download_info’);
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  5. curl_setopt($ch, CURLOPT_POST, 1);
  6. curl_setopt($ch, CURLOPT_POSTFIELDS, "{"driveId":0,"etag":"39a604a25e4d7bbc7c640ce4ae2e0bd7","fileId":1806172,"s3keyFlag":"1812603032-0","type":0,"fileName":"videoplayback.mp4","size":60242630}");
  7. $headers = array();
  8. $headers[] = ‘Content-Type: application/json’;
  9. $headers[] = ‘Host: www.123pan.com’;
  10. $headers[] = ‘Origin: https://www.123pan.com’;
  11. $headers[] = ‘Referer: https://www.123pan.com/’;
  12. $headers[] = ‘User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36’;
  13. $headers[] = ‘Authorization: xxxxx’;
  14. curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  15. $result = curl_exec($ch);
  16. if (curl_errno($ch)) {
  17.     echo ‘Error:’ . curl_error($ch);
  18. }
  19. curl_close($ch);
  20. ?>

复制代码

正确执行之后,会得到这样的一个json返回结果

  1. {"code":0,"message":"ok","data":{"AccessKeyId":null,"SecretAccessKey":null,"SessionToken":null,"Expiration":null,"Key":"","Bucket":"","FileId":0,"Reuse":false,"Info":null,"UploadId":"","DownloadUrl":"https://download.123pan.cn/123-983/39a604a2/1812603032-0/39a604a25e4d7bbc7c640ce4ae2e0bd7?v=3u0026t=1662602379u0026s=e1062748ac0ff2d52bdbf38c1ff5aaa4u0026i=7284c7efu0026filename=videoplayback.mp4"}}

复制代码

DownloadUrl

  1. https://download.123pan.cn/123-983/39a604a2/1812603032-0/39a604a25e4d7bbc7c640ce4ae2e0bd7?v=3&t=1662602379&s=e1062748ac0ff2d52bdbf38c1ff5aaa4&i=7284c7ef&filename=videoplayback.mp4

复制代码

就是下载地址
他会302跳转到一个直链地址。

alist早就添加上去了。。