Quan666 / PikPakAPI

PikPak API
135 stars 42 forks source link

通过分享链接保存文件 #43

Closed ghost closed 1 month ago

ghost commented 3 months ago

希望可以给定一个Url然后保存到自己的pikpak中

Quan666 commented 3 months ago

https://github.com/Quan666/PikPakAPI/blob/b786f9af48e9335b474274c27f39b4a05070f5a1/pikpakapi/__init__.py#L354-L374

这不就是?

ghost commented 3 months ago

https://github.com/Quan666/PikPakAPI/blob/b786f9af48e9335b474274c27f39b4a05070f5a1/pikpakapi/__init__.py#L354-L374

这不就是?

可以保存 https://mypikpak.com/s/ 这种别人分享的链接么,我一保存这个就报错

Quan666 commented 3 months ago

这个不行 得保存分享的接口才行,你可以抓包然后实现下

Quan666 commented 3 months ago

获取分享详情的接口:

fetch("https://api-drive.mypikpak.com/drive/v1/share?limit=100&thumbnail_size=SIZE_LARGE&order=6&share_id={分享share_id}&pass_code={分享密码,没有就不传}", {
  "headers": {
    "accept-language": "zh-CN",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "x-captcha-token": "xxxxxxxxx",
    "x-device-id": "xxxxxxxx"
  },
  "referrer": "https://mypikpak.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "GET",
  "mode": "cors",
  "credentials": "omit"
});

保存分享 全部文件 的接口:

fetch("https://api-drive.mypikpak.com/drive/v1/share/restore", {
  "headers": {
    "accept-language": "zh-CN",
    "authorization": "Bearer xxxxxx",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "x-captcha-token": "xxxxxxx",
    "x-device-id": "xxxx"
  },
  "referrer": "https://mypikpak.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"share_id\":\"分享id\",\"pass_code_token\":\"分享接口有\",\"params\":{\"trace_file_ids\":\"保存到指定文件夹的id\"}}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

保存分享 指定文件 的接口:

fetch("https://api-drive.mypikpak.com/drive/v1/share/restore", {
  "headers": {
    "accept-language": "zh-CN",
    "authorization": "Bearer xxxxxx",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "x-captcha-token": "xxxxxxx",
    "x-device-id": "xxxx"
  },
  "referrer": "https://mypikpak.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"share_id\":\"分享id\",\"pass_code_token\":\"分享接口有\",\"file_ids\":[\"要保存的文件id\"],\"params\":{\"trace_file_ids\":\"保存到指定文件夹的id\"}}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});
ghost commented 3 months ago

获取分享详情的接口:

fetch("https://api-drive.mypikpak.com/drive/v1/share?limit=100&thumbnail_size=SIZE_LARGE&order=6&share_id={分享share_id}&pass_code={分享密码}", {
  "headers": {
    "accept-language": "zh-CN",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "x-captcha-token": "xxxxxxxxx",
    "x-device-id": "xxxxxxxx"
  },
  "referrer": "https://mypikpak.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "GET",
  "mode": "cors",
  "credentials": "omit"
});

保存分享 全部文件 的接口:

fetch("https://api-drive.mypikpak.com/drive/v1/share/restore", {
  "headers": {
    "accept-language": "zh-CN",
    "authorization": "Bearer xxxxxx",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "x-captcha-token": "xxxxxxx",
    "x-device-id": "xxxx"
  },
  "referrer": "https://mypikpak.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"share_id\":\"分享id\",\"pass_code_token\":\"分享接口有\",\"params\":{\"trace_file_ids\":\"保存到指定文件夹的id\"}}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

保存分享 指定文件 的接口:

fetch("https://api-drive.mypikpak.com/drive/v1/share/restore", {
  "headers": {
    "accept-language": "zh-CN",
    "authorization": "Bearer xxxxxx",
    "content-type": "application/json",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "x-captcha-token": "xxxxxxx",
    "x-device-id": "xxxx"
  },
  "referrer": "https://mypikpak.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "{\"share_id\":\"分享id\",\"pass_code_token\":\"分享接口有\",\"file_ids\":[\"要保存的文件id\"],\"params\":{\"trace_file_ids\":\"保存到指定文件夹的id\"}}",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

我太爱你了啊哥 nbnb我刚才还在研究没弄出来,你这一下子就ok了

Quan666 commented 1 month ago

https://github.com/Quan666/PikPakAPI/pull/57