client

此模块包含了客户端操作的基本封装

115 客户端模块

class p115client.client.P115Client(cookies: None | str | PathLike | Mapping[str, str] | Iterable[Mapping | Cookie | Morsel] = None, app: str = '', app_id: int = 0, console_qrcode: bool = True)[source]

Bases: P115OpenClient

115 的客户端对象

Note

目前允许 1 个用户同时登录多个开放平台应用(用 AppID 区别),也允许多次授权登录同 1 个应用

同一个开放应用 id,最多同时有 3 个登入,如果有新的登录,则自动踢掉较早的那一个

目前不允许短时间内再次用 refresh_token 刷新 access_token,但你可以用登录的方式再次授权登录以获取 access_token,即可不受频率限制

1 个 refresh_token 只能使用 1 次,可获取新的 refresh_tokenaccess_token,如果请求刷新时,发送成功但读取失败,可能导致 refresh_token 报废,这时需要重新授权登录

Parameters:
  • cookies

    115 的 cookies,要包含 UIDCIDKIDSEID

    • 如果是 None,则会要求人工扫二维码登录

    • 如果是 str,则要求是格式正确的 cookies 字符串,例如 “UID=…; CID=…; KID=…; SEID=…”

    • 如果是 bytes 或 os.PathLike,则视为路径,当更新 cookies 时,也会往此路径写入文件,格式要求同上面的 str

    • 如果是 collections.abc.Mapping,则是一堆 cookie 的名称到值的映射

    • 如果是 collections.abc.Iterable,则其中每一条都视为单个 cookie

  • app – 重新登录时人工扫二维码后绑定的 app (或者叫 device),如果不指定,则根据 cookies 的 UID 字段来确定,如果不能确定,则用 “qandroid”

  • app_id – 授权的 open 应用的 AppID

  • console_qrcode – 在命令行输出二维码,否则在浏览器中打开


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

act_xys_adopt(payload: dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_adopt(payload: dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

采纳助愿

POST https://act.115.com/api/1.0/{app}/1.0/act2024xys/adopt

Payload:
  • did: str 💡 许愿的 id

  • aid: int | str 💡 助愿的 id

  • to_cid: int = <default> 💡 助愿中的分享链接转存到你的网盘中目录的 id

act_xys_aid_desire(payload: dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_aid_desire(payload: dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

创建助愿(如果提供 file_ids,则会创建一个分享链接)

POST https://act.115.com/api/1.0/{app}/1.0/act2024xys/aid_desire

Payload:
  • id: str 💡 许愿 id

  • content: str 💡 助愿文本,不少于 5 个字,不超过 500 个字

  • images: int | str = <default> 💡 图片文件在你的网盘的 id,多个用逗号 “,” 隔开

  • file_ids: int | str = <default> 💡 文件在你的网盘的 id,多个用逗号 “,” 隔开

act_xys_aid_desire_del(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_aid_desire_del(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除助愿

POST https://act.115.com/api/1.0/{app}/1.0/act2024xys/del_aid_desire

Payload:
  • ids: int | str 💡 助愿的 id,多个用逗号 “,” 隔开

act_xys_desire_aid_list(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_desire_aid_list(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取许愿的助愿列表

GET https://act.115.com/api/1.0/{app}/1.0/act2024xys/desire_aid_list

Payload:
  • id: str 💡 许愿的 id

  • start: int = 0 💡 开始索引

  • page: int = 1 💡 第几页

  • limit: int = 10 💡 分页大小

  • sort: int | str = <default> 💡 排序

act_xys_get_act_info(app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_get_act_info(app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取许愿树活动的信息

GET https://act.115.com/api/1.0/{app}/1.0/act2024xys/get_act_info

act_xys_get_desire_info(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_get_desire_info(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取的许愿信息

GET https://act.115.com/api/1.0/{app}/1.0/act2024xys/get_desire_info

Payload:
  • id: str 💡 许愿的 id

act_xys_home_list(app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_home_list(app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

首页的许愿树(随机刷新 15 条)

GET https://act.115.com/api/1.0/{app}/1.0/act2024xys/home_list

act_xys_my_aid_desire(payload: int | str | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_my_aid_desire(payload: int | str | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我的助愿列表

GET https://act.115.com/api/1.0/{app}/1.0/act2024xys/my_aid_desire

Payload:
  • type: 0 | 1 | 2 = 0 💡 类型

    • 0: 全部

    • 1: 进行中

    • 2: 已实现

  • start: int = 0 💡 开始索引

  • page: int = 1 💡 第几页

  • limit: int = 10 💡 分页大小

act_xys_my_desire(payload: int | str | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_my_desire(payload: int | str | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我的许愿列表

GET https://act.115.com/api/1.0/{app}/1.0/act2024xys/my_desire

Payload:
  • type: 0 | 1 | 2 = 0 💡 类型

    • 0: 全部

    • 1: 进行中

    • 2: 已实现

  • start: int = 0 💡 开始索引

  • page: int = 1 💡 第几页

  • limit: int = 10 💡 分页大小

act_xys_wish(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_wish(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

创建许愿

POST https://act.115.com/api/1.0/{app}/1.0/act2024xys/wish

Payload:
  • content: str 💡 许愿文本,不少于 5 个字,不超过 500 个字

  • rewardSpace: int = 5 💡 奖励容量,单位是 GB

  • images: int | str = <default> 💡 图片文件在你的网盘的 id,多个用逗号 “,” 隔开

act_xys_wish_del(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
act_xys_wish_del(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://act.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除许愿

POST https://act.115.com/api/1.0/{app}/1.0/act2024xys/del_wish

Payload:
  • ids: str 💡 许愿的 id,多个用逗号 “,” 隔开

captcha_all(base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[False] = False, **request_kwargs) bytes[source]
captcha_all(base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, bytes]

返回一张包含 10 个汉字的图片,包含验证码中 4 个汉字(有相应的编号,从 0 到 9,计数按照从左到右,从上到下的顺序)

GET https://captchaapi.115.com/?ct=index&ac=code&t=all

captcha_code(base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[False] = False, **request_kwargs) bytes[source]
captcha_code(base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, bytes]

更新验证码,并获取图片数据(含 4 个汉字)

GET https://captchaapi.115.com/?ct=index&ac=code

captcha_sign(base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
captcha_sign(base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取验证码的签名字符串

GET https://captchaapi.115.com/?ac=code&t=sign

captcha_single(payload: dict | int = 0, /, base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[False] = False, **request_kwargs) bytes[source]
captcha_single(payload: dict | int = 0, /, base_url: str | Callable[[], str] = 'https://captchaapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, bytes]

10 个汉字单独的图片,包含验证码中 4 个汉字,编号从 0 到 9

GET https://captchaapi.115.com/?ct=index&ac=code&t=single

Payload:
  • id: int = 0

captcha_verify(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
captcha_verify(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

提交验证码

POST https://webapi.115.com/user/captcha

Payload:
  • code: int | str 💡 从 0 到 9 中选取 4 个数字的一种排列

  • sign: str = <default> 💡 来自 captcha_sign 接口的响应

  • ac: str = “security_code” 💡 默认就行,不要自行决定

  • type: str = “web” 💡 默认就行,不要自行决定

  • ctype: str = “web” 💡 需要和 type 相同

  • client: str = “web” 💡 需要和 type 相同

clouddownload_downpath(payload: dict | int = 10, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_downpath(payload: dict | int = 10, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前默认的云下载到的目录信息(可能有多个)

GET https://webapi.115.com/offine/downpath

Payload:
  • limit: int = 1150

clouddownload_downpath_set(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_downpath_set(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置默认选择的云下载到的目录信息

POST https://webapi.115.com/offine/downpath

Payload:
  • file_id: int | str 💡 目录 id

clouddownload_get_id(payload: dict | int = 1, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_get_id(payload: dict | int = 1, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取和云下载有关的目录 id

GET https://clouddownload.115.com/?ac=get_id

Note

调用此接口后,如果相关目录不存在,则会自动创建。 响应数据里,”cid” 对应的是上传的种子文件的保存目录,”dest_cid” 是云下载的目录

Payload:
  • torrent: int = 1

clouddownload_quota_info(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_quota_info(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前云下载配额信息(简略)

GET https://clouddownload.115.com/?ac=get_quota_info

clouddownload_quota_package_array(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_quota_package_array(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前云下载配额信息(详细)

GET https://clouddownload.115.com/?ac=get_quota_package_array

clouddownload_quota_package_info(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_quota_package_info(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前云下载配额信息(详细)

GET https://clouddownload.115.com/?ac=get_quota_package_info

clouddownload_sign(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_sign(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 sign 和 time 字段(各个添加任务的接口需要),以及其它信息

GET https://115.com/?ct=clouddownload&ac=space

clouddownload_sign_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_sign_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 sign 和 time 字段(各个添加任务的接口需要)

GET https://proapi.115.com/{app}/files/offlinesign

clouddownload_task(payload: str | dict, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task(payload: str | dict, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取云下载任务信息

GET https://clouddownload.115.com/?ac=get_user_task

Payload:
  • info_hash: str

clouddownload_task_add_bt(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'ssp', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_add_bt(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'ssp', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加一个种子作为云下载任务

POST https://clouddownload.115.com/lixianssp/?ac=add_task_bt

Note

client.clouddownload_task_add_bt(info_hash) 相当于 client.clouddownload_task_add_url(f”magnet:?xt=urn:btih:{info_hash}”)

但此接口的优势是允许选择要下载的文件

Payload:
  • info_hash: str 💡 种子文件的 info_hash

  • wanted: str = <default> 💡 选择文件进行下载(是数字索引,从 0 开始计数,用 “,” 分隔)

  • savepath: str = <default> 💡 保存到 wp_path_id 对应目录下的相对路径

  • wp_path_id: int | str = <default> 💡 保存到目录的 id

clouddownload_task_add_url(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'ssp', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_add_url(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'ssp', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加一个云下载任务

POST https://clouddownload.115.com/lixianssp/?ac=add_task_url

Payload:
  • url: str 💡 链接,支持HTTP、HTTPS、FTP、磁力链和电驴链接

  • savepath: str = <default> 💡 保存到目录下的相对路径

  • wp_path_id: int | str = <default> 💡 保存到目录的 id

clouddownload_task_add_urls(payload: str | Iterable[str] | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'ssp', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_add_urls(payload: str | Iterable[str] | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'ssp', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加一组云下载任务

POST https://clouddownload.115.com/lixianssp/?ac=add_task_urls

Payload:
  • url: str 💡 链接,支持HTTP、HTTPS、FTP、磁力链和电驴链接

  • url[0]: str 💡 链接,支持HTTP、HTTPS、FTP、磁力链和电驴链接

  • url[1]: str

  • savepath: str = <default> 💡 保存到目录下的相对路径

  • wp_path_id: int | str = <default> 💡 保存到目录的 id

clouddownload_task_clear(payload: int | dict = 0, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_clear(payload: int | dict = 0, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

清空云下载任务列表

POST https://clouddownload.115.com/?ac=task_clear

Payload:
  • flag: int = 0 💡 标识,用于对应某种情况

    • 0: 已完成

    • 1: 全部

    • 2: 已失败

    • 3: 进行中

    • 4: 已完成+删除源文件

    • 5: 全部+删除源文件

clouddownload_task_cnt(payload: dict | int = 0, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_cnt(payload: dict | int = 0, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前正在运行的云下载任务数

GET https://clouddownload.115.com/?ac=get_task_cnt

Payload:
  • flag: int = 0

clouddownload_task_count(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_count(method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前各种类型任务的计数

GET https://clouddownload.115.com/?ac=task_count

clouddownload_task_del(payload: str | Iterable[str] | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_del(payload: str | Iterable[str] | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除一组云下载任务(无论是否已经完成)

POST https://clouddownload.115.com/?ac=task_del

Payload:
  • hash[0]: str

  • hash[1]: str

  • flag: 0 | 1 = <default> 💡 是否删除源文件

clouddownload_task_list(payload: int | dict = 1, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_list(payload: int | dict = 1, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前的云下载任务列表

GET https://clouddownload.115.com/?ac=task_lists

Payload:
  • page: int = 1

  • page_size: int = 30

  • stat: int = <default> 💡 已知:9:已失败 11:已完成 12:进行中

clouddownload_task_pause(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_pause(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

暂停云下载任务

POST https://clouddownload.115.com/?ac=pause_task

Payload:
  • info_hash: str 💡 待重试任务的 info_hash

clouddownload_task_restart(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_restart(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

重试云下载任务

POST https://clouddownload.115.com/?ac=restart

Tip

经常会遇到批量添加的磁力链接,因为空间不足而失败,此接口可以用于重试

from p115client import P115Client
from p115client.tool import *
client = P115Client.from_path()

while True:
    resp = client.clouddownload_task_list({"stat": 9})
    tasks = [task for task in resp["tasks"] if task["status"] == 2]
    if not tasks:
        break
    for task in tasks:
        print(client.clouddownload_task_restart(task["info_hash"]))
Payload:
  • info_hash: str 💡 待重试任务的 info_hash

clouddownload_task_resume(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_resume(payload: str | dict, /, method: str = 'POST', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

恢复(被暂停的)云下载任务

POST https://clouddownload.115.com/?ac=resume_task

Payload:
  • info_hash: str 💡 待重试任务的 info_hash

clouddownload_torrent(payload: str | dict, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_torrent(payload: str | dict, /, method: str = 'GET', type: Literal['', 'web', 'ssp'] = 'web', base_url: str | Callable[[], str] = 'https://clouddownload.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查看种子的文件列表等信息

GET https://clouddownload.115.com/?ac=torrent

Payload:
  • sha1: str

diary_add(payload: str | dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_add(payload: str | dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建日记

POST https://life.115.com/api/1.0/{app}/1.0/diary/add

Payload:
  • form[content]: str 💡 内容

  • form[subject]: int | str = <default> 💡 标题

  • form[user_time]: int | float = <default> 💡 时间戳,单位是秒

  • form[weather]: int = <default> 💡 天气

  • form[mood]: int = <default> 💡 心情

  • form[moods]: int | str = <default> 💡 心情,多个用逗号 “,” 隔开

  • form[tags][]: str = <default> 💡 标签

  • form[tags][0]: str = <default> 💡 标签

  • form[index_image] = <default> 💡 封面图片链接

  • form[address]: str = <default> 💡 地点

  • form[location]: str = <default> 💡 地名

  • form[longitude]: float | str = <default> 💡 经度

  • form[latitude]: float | str = <default> 💡 纬度

  • form[mid]: str = <default> 💡 位置编码

  • form[maps]: list[dict] = <default> 💡 多个地图位置

  • form[maps][0][address]: str = <default>

  • form[maps][0][location]: str = <default>

  • form[maps][0][latitude]: float | str = <default>

  • form[maps][0][longitude] float | str = <default>

  • form[maps][0][mid]: str = <default>

diary_del(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_del(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除日记

POST https://life.115.com/api/1.0/{app}/1.0/diary/delete

Payload:
  • diary_id: int | str 💡 日记 id

diary_detail(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_detail(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取日记详情

GET https://life.115.com/api/1.0/{app}/1.0/diary/detail

Payload:
  • diary_id: int | str 💡 日记 id

  • format: str = html

diary_detail2(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_detail2(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取日记详情

GET https://life.115.com/api/1.0/{app}/1.0/life/diarydetail

Payload:
  • diary_id: int | str 💡 日记 id

  • format: str = html

diary_edit(payload: dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_edit(payload: dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改日记

POST https://life.115.com/api/1.0/{app}/1.0/diary/edit

Payload:
  • form[diary_id]: str 💡 日记 id

  • form[content]: str = <default> 💡 内容

  • form[subject]: int | str = <default> 💡 标题

  • form[user_time]: int | float = <default> 💡 时间戳,单位是秒

  • form[weather]: int = <default> 💡 天气

  • form[mood]: int = <default> 💡 心情

  • form[moods]: int | str = <default> 💡 心情,多个用逗号 “,” 隔开

  • form[tags][]: str = <default> 💡 标签

  • form[tags][0]: str = <default> 💡 标签

  • form[index_image] = <default> 💡 封面图片链接

  • form[address]: str = <default> 💡 地点

  • form[location]: str = <default> 💡 地名

  • form[longitude]: float | str = <default> 💡 经度

  • form[latitude]: float | str = <default> 💡 纬度

  • form[mid]: str = <default> 💡 位置编码

  • form[maps]: list[dict] = <default> 💡 多个地图位置

  • form[maps][0][address]: str = <default>

  • form[maps][0][location]: str = <default>

  • form[maps][0][latitude]: float | str = <default>

  • form[maps][0][longitude] float | str = <default>

  • form[maps][0][mid]: str = <default>

diary_get_config(app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_get_config(app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取日记可选项(例如天气、心情等)的取值集合

GET https://life.115.com/api/1.0/{app}/1.0/diary/get_diary_config

diary_get_latest_tags(payload: int | str | dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_get_latest_tags(payload: int | str | dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近使用过的标签列表

GET https://life.115.com/api/1.0/{app}/1.0/diary/getlatesttags

Payload:
  • q: str = “” 💡 筛选关键词

  • color: 0 | 1 = <default>

  • limit: int = <default> 💡 最多返回数量,⚠️ 这个参数似乎无效

diary_get_tag_color(payload: str | list | tuple | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_get_tag_color(payload: str | list | tuple | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取标签的颜色

POST https://life.115.com/api/1.0/{app}/1.0/diary/gettagcolor

Payload:
  • tags: str 💡 标签文本

  • tags[]: str

  • tags[0]: str

  • tags[1]: str

diary_list(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_list(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取日记列表,此接口是对 life_glist 的封装

Payload:
  • start: int = 0 💡 开始索引,从 0 开始

  • limit: int = <default> 💡 分页大小

  • only_public: 0 | 1 = <default>

  • msg_note: 0 | 1 = <default>

  • option: 0 | 1 = <default>

diary_search(payload: str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

搜索日记

GET https://life.115.com/api/1.0/{app}/1.0/diary/search

Payload:
  • q: str 💡 关键词

  • start: int = 0 💡 开始索引,从 0 开始

  • limit: int = <default> 💡 分页大小

  • display_list: 0 | 1 = <default>

diary_settag(payload: dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_settag(payload: dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置日记标签

POST https://life.115.com/api/1.0/{app}/1.0/diary/settag

Payload:
  • diary_id: int | str 💡 日记 id

  • tags: str

  • tags[]: str

  • tags[0]: str

  • tags[1]: str

diary_settop(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
diary_settop(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

切换日记的置顶状态,此接口是对 life_set_top 的封装

Attention

这个接口会自动切换日记的置顶状态,但不支持手动指定是否置顶,只是在置顶和不置顶间来回切换。

Payload:
  • relation_id: int | str 💡 日记 id

download_downfolder_app(payload: str | dict, /, app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_downfolder_app(payload: str | dict, /, app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取待下载的文件列表

GET https://proapi.115.com/{app}/folder/downfolder

Caution

一次性拉完,当文件过多时,会报错

Payload:
  • pickcode: str 💡 提取码

  • share_id: int | str 💡 共享 id

download_files_app(payload: str | dict, /, app: str = 'chrome', version: str = '2.0', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_files_app(payload: str | dict, /, app: str = 'chrome', version: str = '2.0', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取待下载的文件列表

GET https://proapi.115.com/app/chrome/downfiles

Caution

不允许直接从根目录获取,因为根目录没有 pickcode

Tip

如果 app 不是 “chrome”,那么会多一个字段 “sha1”,虽依然没有文件名,但有 “fs”(文件大小),搭配 “sha1” 可以用于检测文件重复

Payload:
  • pickcode: str 💡 提取码

  • page: int = 1 💡 第几页

  • per_page: int = 5000 💡 每页大小,目前最大为 5000

download_folders_app(payload: str | dict, /, app: str = 'chrome', version: str = '2.0', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_folders_app(payload: str | dict, /, app: str = 'chrome', version: str = '2.0', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取待下载的目录列表

GET https://proapi.115.com/app/chrome/downfolders

Caution

不允许直接从根目录获取,因为根目录没有 pickcode

Payload:
  • pickcode: str 💡 提取码

  • page: int = 1 💡 第几页

  • per_page: int = 5000 💡 每页大小,目前最大为 5000

download_url(pickcode: int | str, /, strict: bool = True, user_agent: None | str = None, app: str = 'os_windows', *, async_: Literal[False] = False, **request_kwargs) P115URL[source]
download_url(pickcode: int | str, /, strict: bool = True, user_agent: None | str = None, app: str = 'os_windows', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115URL]

获取文件的下载链接

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcode – 提取码

  • strict – 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • app – 使用此设备的接口

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

download_url_app(payload: str | dict, /, user_agent: None | str = None, app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_url_app(payload: str | dict, /, user_agent: None | str = None, app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件的下载链接

POST https://proapi.115.com/app/chrome/downurl

Note

app 为 “chrome” 时,支持一次获取多个提取码对应的下载链接,但是每多一个提取码,大概多耗时 50 ms,猜测服务端也是逐个从某个服务获取下载链接的。

如果 app 为 “chrome”,则仅支持 aid=1 的提取码获取下载链接(以前是不限制 aid 的,这样甚至可以获取已经删除的文件的下载链接);否则,还支持 aid=12 的下载链接。

Attention

尽量不要尝试对已经删除的文件获取下载链接,不仅会失败,还容易触发风控

Payload:
  • pickcode: str 💡 如果 app 为 “chrome”,则可以接受多个,多个用逗号 “,” 隔开

  • pick_code: str 💡 如果不用 pickcode,那就用 pick_code

  • share_id: int | str = <default> 💡 共享 id

  • user_id: int = <default>

download_url_web(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_url_web(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件的下载链接(网页版接口)

GET https://webapi.115.com/files/download

Note

最大允许下载 200 MB 的文件,即使文件违规,或者 aid=12,也可以正常下载

Payload:
  • pickcode: str

  • dl: int = 0 💡 如果不为 0,则需要从响应中提取 “file_url_302” 字段,得到一个链接(只能被访问一次,但无需 cookies),然后访问此链接,才能从中获得最终的下载链接

download_url_web2(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://115.com', user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_url_web2(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://115.com', user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件的下载链接(网页版接口)

GET https://115.com/?ct=download&ac=video

Note

最大允许下载 200 MB 的文件,即使文件已被删除,也可以正常下载

Payload:
  • pickcode: str

download_urls(pickcodes: int | str | Iterable[int | str], /, strict: bool = True, user_agent: None | str = None, app: str = 'os_windows', *, async_: Literal[False] = False, **request_kwargs) dict[int, P115URL][source]
download_urls(pickcodes: int | str | Iterable[int | str], /, strict: bool = True, user_agent: None | str = None, app: str = 'os_windows', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict[int, P115URL]]

批量获取文件的下载链接

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcodes – 提取码,多个用逗号 “,” 隔开

  • strict – 如果为 True,当目标是目录时,会直接忽略

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • app – 使用此设备的接口,要么是 “open”,要么是 “chrome”(或者其他任何值)

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

一批下载链接

extract_add_file(payload: list | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_add_file(payload: list | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

解压缩到某个目录,推荐直接用封装函数 extract_file

POST https://webapi.115.com/files/add_extract_file

Caution

【解压到】任务不可并发、不可中止,空目录不会被导出,不会产生 life 操作事件。 目录层级最多 25 级(不算文件节点),对于超出此限制的路径,会直接把最终的文件保存到第 25 级之下,如果因此造成同名,会在扩展名前加 (1),数字逐次增加,以此类推。 但如果文件名是类似 “.name” 的格式,会被视为 “.name.name” 处理,也就是名字翻倍,然后处理成 “.name(1).name”、”.name(2).name”、… 这样累计下去,此时整个名字最多 510 字节(按 utf-8 编码算,即 255 * 2),此时扩展名不会变,只会截断当它充当文件名时尾部的一部分。 名字里面如果有 <>” 这 3 个字符,则会被替换为下划线 _。 文件名最多 75 个字符(不包括扩展名部分),超出部分会被截断。扩展名部分,不算前缀点号 . 时,最多 254 个字节(按 utf-8 编码算),但如果所有字符都相同的中文字,却最多只有 75 个(为什么呢?)。

Payload:
  • pick_code: str

  • extract_file: str = “”

  • extract_dir: str = “”

  • extract_file[]: str

  • extract_file[]: str

  • to_pid: int | str = 0

  • paths: str = “文件”

extract_add_file_app(payload: list | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_add_file_app(payload: list | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

解压缩到某个目录,推荐直接用封装函数 extract_file

POST https://proapi.115.com/{app}/2.0/ufile/add_extract_file

Caution

【解压到】任务不可并发、不可中止,空目录不会被导出,不会产生 life 操作事件。 目录层级最多 25 级(不算文件节点),对于超出此限制的路径,会直接把最终的文件保存到第 25 级之下,如果因此造成同名,会在扩展名前加 (1),数字逐次增加,以此类推。 但如果文件名是类似 “.name” 的格式,会被视为 “.name.name” 处理,也就是名字翻倍,然后处理成 “.name(1).name”、”.name(2).name”、… 这样累计下去,此时整个名字最多 510 字节(按 utf-8 编码算,即 255 * 2),此时扩展名不会变,只会截断当它充当文件名时尾部的一部分。 名字里面如果有 <>” 这 3 个字符,则会被替换为下划线 _。 文件名最多 75 个字符(不包括扩展名部分),超出部分会被截断。扩展名部分,不算前缀点号 . 时,最多 254 个字节(按 utf-8 编码算),但如果所有字符都相同的中文字,却最多只有 75 个(为什么呢?)。

Payload:
  • pick_code: str

  • extract_file: str = “”

  • extract_dir: str = “”

  • extract_file[]: str

  • extract_file[]: str

  • to_pid: int | str = 0

  • paths: str = “文件”

extract_download_url(pickcode: str, path: str, user_agent: None | str = None, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) P115URL[source]
extract_download_url(pickcode: str, path: str, user_agent: None | str = None, app: str = 'android', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115URL]

获取压缩包中文件的下载链接

Parameters:
  • pickcode – 压缩包的提取码

  • path – 文件在压缩包中的路径

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

extract_download_url_app(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', user_agent: None | str = None, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_download_url_app(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', user_agent: None | str = None, app: str = 'android', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩包中文件的下载链接

GET https://proapi.115.com/{app}/2.0/ufile/extract_down_file

Payload:
  • pick_code: str

  • full_name: str

  • dl: int = <default>

extract_download_url_web(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_download_url_web(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩包中文件的下载链接

GET https://webapi.115.com/files/extract_down_file

Payload:
  • pick_code: str

  • full_name: str

extract_file(pickcode: str, files: str | Iterable[str] = '', dirs: str | Iterable[str] = '', dirname: str = '', to_pid: int | str = 0, app: str = 'web', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_file(pickcode: str, files: str | Iterable[str] = '', dirs: str | Iterable[str] = '', dirname: str = '', to_pid: int | str = 0, app: str = 'web', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

解压缩到某个目录,此方法是对 extract_add_file 的封装,推荐使用

Caution

【解压到】任务不可并发、不可中止,空目录不会被导出,不会产生 life 操作事件。 目录层级最多 25 级(不算文件节点),对于超出此限制的路径,会直接把最终的文件保存到第 25 级之下,如果因此造成同名,会在扩展名前加 (1),数字逐次增加,以此类推。 但如果文件名是类似 “.name” 的格式,会被视为 “.name.name” 处理,也就是名字翻倍,然后处理成 “.name(1).name”、”.name(2).name”、… 这样累计下去,此时整个名字最多 510 字节(按 utf-8 编码算,即 255 * 2),此时扩展名不会变,只会截断当它充当文件名时尾部的一部分。 名字里面如果有 <>” 这 3 个字符,则会被替换为下划线 _。 文件名最多 75 个字符(不包括扩展名部分),超出部分会被截断。扩展名部分,不算前缀点号 . 时,最多 254 个字节(按 utf-8 编码算),但如果所有字符都相同的中文字,却最多只有 75 个(为什么呢?)。

Note

一次解压任务,似乎最多 1 万个文件,而且会排除空目录。但你完全可以利用这一点,来批量创建一个目录结构。 虽然分次也能解压极大的压缩包,但相应的云解压的耗时也会同步大量增加,处理起来也更为复杂,我建议每次最好限制在 1 万条叶子节点以下。

  1. 首先创建一个压缩包 zip 文件,把目录结构写进去,且为每个目录创建一个空文件,以避免被视为空目录(为了提高效率,请先把所有非叶子节点过滤掉)

    from io import BytesIO
    from zipfile import ZipFile
    
    f = BytesIO()
    with ZipFile(f, "w") as z:
        for dir in dirs:
            z.writestr(dir + "/.placeholder", "")
    
  2. 把所创建的 zip 压缩包上传到网盘

    from p115client import check_response, P115Client
    
    client = P115Client.from_path()
    
    resp = client.upload_file_sample(f.getbuffer(), filename='a.zip')
    check_response(resp)
    pickcode = resp["data"]["pick_code"]
    
  3. 将压缩包云解压

    client.extract_push(pickcode)
    # 查看进度用:client.extract_push_progress(pickcode)
    
  4. 等待云解压完成后,把压缩包解压到网盘(耗时较长,且不可并发)

    client.extract_file(pickcode)
    
  5. 解压完成后,把里面所有的 .placeholder 占位文件找出来删了,这里假设顶层目录 id 是 pid

    from p115client.tool import batch_delete, iter_download_files
    
    empty_file_hash = "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
    files = (
        info["pc"]
        for info in iter_download_nodes(client, pid, app="android", get_raw=True)
        if info["sha1"] == empty_file_hash
    )
    batch_delete(client, files)
    
Parameters:
  • pickcode – 压缩文件的提取码

  • files – 待解压缩的文件路径(相对于 dirname),如果以 “/” 结尾,则视为目录

  • dirs – 待解压缩的文件路径(相对于 dirname

  • dirname – 压缩包内路径,为空则是压缩包的根目录

  • to_pid – 解压到网盘的目录 id

  • app – 使用此设备的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

接口响应,会返回一个 “extract_id”,需要你去轮询获取进度

extract_folders(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_folders(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表(简略信息)

GET https://webapi.115.com/files/extract_folders

Payload:
  • pick_code: str 💡 压缩包文件的提取码

  • full_dir_name: str 💡 多个用逗号 “,” 隔开

  • full_file_name: str = <default> 💡 多个用逗号 “,” 隔开

extract_folders_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_folders_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表(简略信息)

GET https://proapi.115.com/{app}/2.0/ufile/extract_folders

Payload:
  • pick_code: str 💡 压缩包文件的提取码

  • full_dir_name: str 💡 多个用逗号 “,” 隔开

  • full_file_name: str = <default> 💡 多个用逗号 “,” 隔开

extract_folders_post(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_folders_post(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表是否可批量下载(最高支持1万的文件操作数量)

POST https://webapi.115.com/files/extract_folders

Payload:
  • pick_code: str 💡 压缩包文件的提取码

  • full_dir_name: str 💡 多个用逗号 “,” 隔开

  • full_file_name: str = <default> 💡 多个用逗号 “,” 隔开

extract_folders_post_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_folders_post_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表是否可批量下载(最高支持1万的文件操作数量)

POST https://proapi.115.com/{app}/2.0/ufile/extract_folders

Payload:
  • pick_code: str 💡 压缩包文件的提取码

  • full_dir_name: str 💡 多个用逗号 “,” 隔开

  • full_file_name: str = <default> 💡 多个用逗号 “,” 隔开

extract_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表,推荐直接用封装函数 extract_list

GET https://webapi.115.com/files/extract_info

Payload:
  • pick_code: str

  • file_name: str = “” 💡 在压缩包中的相对路径

  • next_marker: str = “”

  • page_count: int | str = 999 💡 分页大小,介于 1-999

  • paths: str = “文件” 💡 省略即可

extract_info_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_info_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表,推荐直接用封装函数 extract_list_app

GET https://proapi.115.com/{app}/2.0/ufile/extract_info

Payload:
  • pick_code: str

  • file_name: str = “” 💡 在压缩包中的相对路径

  • next_marker: str = “”

  • page_count: int | str = 999 💡 分页大小,介于 1-999

  • paths: str = “文件” 💡 省略即可

extract_list(pickcode: str, path: str = '', next_marker: str = '', page_count: int = 999, app: str = 'web', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_list(pickcode: str, path: str = '', next_marker: str = '', page_count: int = 999, app: str = 'web', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取压缩文件的文件列表,此方法是对 extract_info 的封装,推荐使用

Parameters:
  • pickcode – 压缩文件的提取码

  • path – 压缩包内(目录)路径,为空则是压缩包的根目录

  • next_marker – 翻页标记,用来获取下一页

  • page_count – 这一页有多少条数据,范围在 [1, 999]

  • app – 使用此设备的接口

  • async – 是否异步

  • request_kwargs – 其它请求参数

Returns:

接口响应

extract_progress(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_progress(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 解压缩到目录 任务的进度

GET https://webapi.115.com/files/add_extract_file

Payload:
  • extract_id: str

extract_progress_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_progress_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 解压缩到目录 任务的进度

GET https://proapi.115.com/{app}/2.0/ufile/add_extract_file

Payload:
  • extract_id: str

extract_push(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_push(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

推送一个解压缩任务给服务器,完成后,就可以查看压缩包的文件列表了

Warning

只能云解压 20GB 以内文件,不支持云解压分卷压缩包,只支持 .zip、.rar 和 .7z 等

POST https://webapi.115.com/files/push_extract

Payload:
  • pick_code: str

  • secret: str = “” 💡 解压密码

extract_push_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_push_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

推送一个解压缩任务给服务器,完成后,就可以查看压缩包的文件列表了

Warning

只能云解压 20GB 以内文件,不支持云解压分卷压缩包,只支持 .zip、.rar 和 .7z 等

POST https://proapi.115.com/{app}/2.0/ufile/push_extract

Payload:
  • pick_code: str

  • secret: str = “” 💡 解压密码

extract_push_progress(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_push_progress(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查询解压缩任务的进度

GET https://webapi.115.com/files/push_extract

Payload:
  • pick_code: str

extract_push_progress_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
extract_push_progress_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查询解压缩任务的进度

GET https://proapi.115.com/{app}/2.0/ufile/push_extract

Payload:
  • pick_code: str

fs_batch_edit(payload: list | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_batch_edit(payload: list | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量设置文件或目录(显示时长等)

POST https://webapi.115.com/files/batch_edit

Payload:
  • show_play_long[{fid}]: 0 | 1 = 1 💡 设置或取消显示时长

fs_batch_edit_app(payload: list | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_batch_edit_app(payload: list | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量设置文件或目录(显示时长等)

POST https://proapi.115.com/{app}/files/batch_edit

Payload:
  • show_play_long[{fid}]: 0 | 1 = 1 💡 设置或取消显示时长

fs_category_get(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_category_get(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

显示属性,可获取文件或目录的统计信息(提示:但得不到根目录的统计信息,所以 cid 为 0 时无意义)

GET https://webapi.115.com/category/get

Caution

尝试获取目录的信息时,会去计算目录中文件和目录的数量、总文件大小 等信息,可能会消耗大量时间,但短时间内再次查询同一目录,耗时可能会大大减小

Payload:
  • cid: int | str

  • fid: int | str 💡 cidfid 至少需要提供一个

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • status: 0 | 1 = <default> 💡 如果为 1,那么文件已被删除,会返回错误

fs_category_get_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_category_get_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

显示属性,可获取文件或目录的统计信息(提示:但得不到根目录的统计信息,所以 cid 为 0 时无意义)

GET https://proapi.115.com/{app}/2.0/category/get

Caution

尝试获取目录的信息时,会去计算目录中文件和目录的数量、总文件大小 等信息,可能会消耗大量时间,但短时间内再次查询同一目录,耗时可能会大大减小

Payload:
  • cid: int | str

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

fs_category_shortcut(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_category_shortcut(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

快捷入口列表(罗列所有的快捷入口)

GET https://webapi.115.com/category/shortcut

Payload:
  • offset: int = 0

  • limit: int = 1150

fs_category_shortcut_set(payload: int | str | Iterable[int | str] | dict, /, set: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_category_shortcut_set(payload: int | str | Iterable[int | str] | dict, /, set: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

把一个目录设置或取消为快捷入口(快捷入口需要是目录)

POST https://webapi.115.com/category/shortcut

Payload:
  • file_id: int | str 目录 id,多个用逗号 “,” 隔开

  • op: “add” | “delete” | “top” = “add” 操作代码

    • “add”: 添加

    • “delete”: 删除

    • “top”: 置顶

fs_copy(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_copy(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

复制文件或目录

POST https://webapi.115.com/files/copy

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • fid: int | str 💡 文件或目录 id,只接受单个 id

  • fid[]: int | str

  • fid[0]: int | str

  • fid[1]: int | str

  • pid: int | str = 0 💡 目标目录 id

fs_copy_app(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_copy_app(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

复制文件或目录

POST https://proapi.115.com/{app}/files/copy

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • fid: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • pid: int | str = 0 💡 目标目录 id

fs_cover_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, fid_cover: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_cover_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, fid_cover: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改封面,可以设置目录的封面,此接口是对 fs_edit 的封装

fs_cover_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, fid_cover: int | str, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_cover_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, fid_cover: int | str, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改封面,可以设置目录的封面,此接口是对 fs_files_update_app 的封装

fs_delete(payload: int | str | dict | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_delete(payload: int | str | dict | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除文件或目录

POST https://webapi.115.com/rb/delete

Caution

⚠️ 请不要并发执行,但不限制文件数

Caution

删除和(从回收站)还原是互斥的,同时最多只允许执行一个操作

Payload:
  • fid: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • fid[]: int | str

  • fid[0]: int | str

  • fid[1]: int | str

  • ignore_warn: 0 | 1 = <default>

  • from: int = <default>

  • pid: int = <default>

fs_delete_app(payload: int | str | dict | Iterable[int | str], /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_delete_app(payload: int | str | dict | Iterable[int | str], /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除文件或目录

POST https://proapi.115.com/{app}/rb/delete

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Caution

删除和(从回收站)还原是互斥的,同时最多只允许执行一个操作

Caution

有超过 5 万个文件和文件夹时,不能直接执行删除。如果删除的只是文件,那么在接口响应时,涉及的文件,已经删除完毕;但如果是目录,那么接口响应时,后台可能还在执行,而删除是不可并发的,因此下一个删除任务执行失败时,只需要反复重试即可

Note

此接口还能删除 aid=12 下的文件,且不会经过回收站(aid=7),而是彻底删除(aid=120

from pathlib import Path
from itertools import batched
from p115client import P115Client

client = P115Client(Path("~/115-cookies.txt").expanduser())
while True:
    fids = [info["fid"] for info in client.fs_files({"aid": 12, "limit": 1150, "show_dir": 0})["data"]]
    if not fids:
        break
    client.fs_delete_app(fids)
Payload:
  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • user_id: int | str = <default> 💡 用户 id

fs_desc(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_desc(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件或目录的备注

GET https://webapi.115.com/files/desc

Payload:
  • file_id: int | str

  • field: str = <default> 💡 可取示例值:”pass”

  • compat: 0 | 1 = 1

  • new_html: 0 | 1 = <default>

fs_desc_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_desc_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件或目录的备注

GET https://proapi.115.com/{app}/files/desc

Payload:
  • file_id: int | str

  • field: str = <default> 💡 可取示例值:”pass”

  • compat: 0 | 1 = 1

  • new_html: 0 | 1 = <default>

fs_desc_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, desc: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_desc_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, desc: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置备注,最多允许 65535 个字节 (64 KB 以内),此接口是对 fs_edit 的封装

Hint

修改文件备注会更新文件的更新时间,即使什么也没改或者改为空字符串

fs_desc_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, desc: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_desc_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, desc: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置备注,最多允许 65535 个字节 (64 KB 以内),此接口是对 fs_files_update_app 的封装

Hint

修改文件备注会更新文件的更新时间,即使什么也没改或者改为空字符串

fs_dir_getid(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_dir_getid(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

由路径获取对应的 id(但只能获取目录,不能获取文件)

GET https://webapi.115.com/files/getid

Payload:
  • path: str

fs_dir_getid2(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_dir_getid2(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

由路径获取对应的 id(但只能获取目录,不能获取文件)

GET https://webapi.115.com/files/get_path_id

Payload:
  • path: str

  • parent_id: int = 0

  • is_create: 0 | 1 = 0 💡 当目录不存在时,是否创建

fs_dir_getid_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_dir_getid_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

由路径获取对应的 id(但只能获取目录,不能获取文件)

GET https://proapi.115.com/{app}/files/getid

Payload:
  • path: str

fs_document(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_document(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文档的信息和下载链接

GET https://webapi.115.com/files/document

Note

即使文件格式不正确或者是一个目录,也可返回一些信息(包括 parent_id)

Payload:
  • pickcode: str

fs_document_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_document_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文档的信息和下载链接

GET https://proapi.115.com/{app}/files/document

Note

即使文件格式不正确或者是一个目录,也可返回一些信息(包括 parent_id)

Payload:
  • pickcode: str

fs_edit(payload: list | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_edit(payload: list | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置文件或目录(备注、标签、封面等)

POST https://webapi.115.com/files/edit

Payload:
  • fid: int | str

  • fid[]: int | str

  • file_desc: str = <default> 💡 可以用 html

  • file_label: int | str = <default> 💡 标签 id,多个用逗号 “,” 隔开

  • fid_cover: int | str = <default> 💡 封面图片的文件 id,多个用逗号 “,” 隔开,如果要删除,值设为 0 即可

  • show_play_long: 0 | 1 = <default> 💡 文件名称显示时长

fs_export_dir(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_export_dir(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

导出目录树

POST https://webapi.115.com/files/export_dir

Caution

【导出目录树】任务不可并发、不可中止,空目录不会被导出,输出的文件不会产生 life 操作事件

Payload:
  • file_ids: int | str 💡 多个用逗号 “,” 隔开

  • target: str = “U_1_0” 💡 导出目录树到这个目录

  • layer_limit: int = <default> 💡 层级深度,自然数

  • not_suffix: str = <default>

fs_export_dir_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_export_dir_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

导出目录树

POST https://proapi.115.com/{app}/2.0/ufile/export_dir

Caution

【导出目录树】任务不可并发、不可中止,空目录不会被导出,输出的文件不会产生 life 操作事件

Payload:
  • file_ids: int | str 💡 多个用逗号 “,” 隔开

  • target: str = “U_1_0” 💡 导出目录树到这个目录

  • layer_limit: int = <default> 💡 层级深度,自然数

fs_export_dir_status(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_export_dir_status(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取导出目录树的完成情况

GET https://webapi.115.com/files/export_dir

Payload:
  • export_id: int | str = 0 💡 任务 id

fs_export_dir_status_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_export_dir_status_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取导出目录树的完成情况

GET https://proapi.115.com/{app}/2.0/ufile/export_dir

Payload:
  • export_id: int | str = 0 💡 任务 id

fs_file(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_file(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件或目录的基本信息

GET https://webapi.115.com/files/get_info

Caution

仅当文件的 aid 是 1(网盘文件)、12(瞬间文件) 或 120(永久删除文件) 时,才能用此接口获取信息,否则请用 client.fs_file_skimclient.fs_supervision 获取信息(只能获取比较简略的信息)。

特别的,文件被移入回收站后,就不能用此接口获取信息了,除非将其还原或永久删除。

Payload:
  • file_id: int | str 💡 文件或目录的 id,不能为 0,只能传 1 个 id,如果有多个只采用第一个

fs_file_skim(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', method: str = 'GET', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_file_skim(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', method: str = 'GET', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件或目录的简略信息

GET https://webapi.115.com/files/file

Note

如果需要查询的 id 特别多,请指定 method=”POST”

Payload:
  • file_id: int | str 💡 文件或目录的 id,不能为 0,多个用逗号 “,” 隔开

fs_files(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息

GET https://webapi.115.com/files

Attention

此接口被风控,此域名下的大量接口都会被风控,但重新登录可能恢复(多次登录必定不能恢复,即使更换设备)

Hint

指定如下条件中任一,且 cur = 0 (默认),即可遍历搜索所在目录树

  1. cid=0 且 star=1

  2. suffix 为非空的字符串

  3. type 为正整数

  4. show_dir=0 且 cur=0(或不指定 cur)

Hint

如果不指定或者指定的 cid 不存在,则会视为 cid=0 进行处理

当指定 natsort=1 时,如果里面的数量较少时,可仅统计某个目录内的文件或目录总数,而不返回具体的文件信息

Hint

当一个 cookies 被另一个更新的登录所失效,并不意味着这个 cookies 就直接不可用了。

如果你使用的是 proapi 下的接口,则会让你重新登录。但是 webapiaps 等之下的接口,却依然可以正常使用。具体哪些失效,哪些还正常,请自行试验总结。这就意味着可以设计一种同一设备多 cookies 做池的分流策略。

Hint

对于普通的文件系统,我们只允许任何一个目录中不可有相同的名字,但是 115 网盘中却可能有重复:

  • 目录和文件同名:文件和目录同名在 115 中不算是一个冲突

  • 相同的目录名:转存可以导致同一目录下有多个相同名字的目录

  • 相同的文件名:转存、云下载和上传等,可以导致同一目录下有多个相同名字的文件

Hint

如果文件或目录被置顶,会在整个文件列表的最前面

在根目录下且 fc_mix=0 且是特殊名字 (“最近接收”, “手机相册”, “云下载”, “我的时光记录”)(即 sys_dir),会在整个文件列表的最前面但在置顶之后,这时可从返回信息的 “sys_count” 字段知道数目

Note

type=1 时,suffix_type 的取值的含义:

  • (不填): 全部

  • 1: 文字(word,即 doc 和 docx 等)

  • 2: 表格(excel,即 xls 和 xlsx 等)

  • 3: 演示(ppt,即 ppt 和 pptx 等)

  • 4: pdf

  • 5: txt

  • 6: xmind

  • 7: 其它

Caution

fields 字段并不以返回的文件列表所有的字段名为准,而是要用其对应的完整名字,例如

  • “file_id”: 对应 “cid”

  • “parent_id”: 对应 “pid”

  • “area_id”: 对应 “aid”

  • “file_name”: 对应 “n”

如果其中有一个是 “cid”,则可能只返回这一个字段,而不管你又指定了其它多少字段。 由于这个参数的行为太过古怪且难猜,所以不建议使用,如果非要使用,建议换用 P115client.fs_files_app()

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,目前最大值是 1,150,以前是没限制的

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数,好像也可以写成 countfolders

  • cur: 0 | 1 = <default> 💡 是否只搜索当前目录

  • custom_order: 0 | 1 = <default> 💡 启用自定义排序,如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 1

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • fields: str = <default> 💡 筛选字段(⚠️ 不建议使用),多个用逗号 “,” 隔开,如果存在字段无效,则文件列表为空(但有计数 “count”、”file_count” 和 “folder_count”)

  • hidden: 0 | 1 = <default>

  • is_q: 0 | 1 = <default> 💡 如果为 1,只显示文件

  • is_share: 0 | 1 = <default>

  • last_utime: int | str = <default>

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting) 💡 natural sorting

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • oof_token: str = <default>

  • qid: int | str = <default>

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录,好像也可以写成 showdir

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • sys_dir: int | str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • suffix_type: int = <default>

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: ???,文档

    • 15: 图片+视频,相当于 2、4

    • 16: 字幕

    • 17~98: 大概相当于 1

    • 99: 所有文件

    • >=100: 大概相当于 1

fs_files_app(payload: None | int | str | dict = 0, /, app: str = 'android', version: str = '2.0', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_app(payload: None | int | str | dict = 0, /, app: str = 'android', version: str = '2.0', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息

GET https://proapi.115.com/{app}/{version}/ufile/files

Hint

如果要遍历获取所有文件,需要指定 show_dir=0 且 cur=0(或不指定 cur),这个接口并没有 type=99 时获取所有文件的意义

Note

一旦此接口被风控,那么同一域名下,所有路径尾部是 /files 的接口都被风控,但是如果你没有携带任何参数,竟然可以避免风控(至少可以用来获得一下文件总数,以及最近的 20 个创建的文件)。 另外,proapi 之下,指定接口的版本为 2.0,可能会被服务器后台专门的处理,而其它版本(乃至于不指定版本),也往往被视为等同的,由此可以分为两类:2.0 版本和其它版本。

Attention

此接口存在一些潜在的问题。假如我上传了一个扩展名特别长的文件,越出了这个接口的能力范围,就会直接报错,例如:

client.upload_file_sample(b"", filename="a."+"a"*300)
# NOTE: 因而下面的请求将不会成功
client.fs_files_app()

Caution

这个接口有些问题:

  1. 当 custom_order=1 时,如果设定 limit=1 可能会报错

  2. fc_mix 无论怎么设置,都和 fc_mix=0 的效果相同(即目录总是置顶),设置为 custom_order=2 也没用

Hint

置顶无效,但可以知道是否置顶了。

在根目录下且 fc_mix=0 且是特殊名字 (“最近接收”, “手机相册”, “云下载”, “我的时光记录”),会在整个文件列表的最前面,这时可从返回信息的 “sys_count” 字段知道数目

Tip

这个接口的 fields 参数可以筛选字段,例如,当你只需要文件 id 时,只需要指定 client.fs_files_app({"fields": "fid"})

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,并没有上限,请预估返回的字节数自行调整规模,7,000 是大约安全了,如果用 fields 筛选了字段,可以增到 10,000,如果报 500 响应,则要适当减小些(或者多次尝试,偶有成功)

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数

  • cur: 0 | 1 = <default> 💡 是否只显示当前目录

  • custom_order: 0 | 1 | 2 = <default> 💡 是否使用记忆排序。如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 2

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • fields: str = <default> 💡 筛选字段,多个用逗号 “,” 隔开,如果所有字段都无效,则返回全部

  • for: str = <default> 💡 文件格式,例如 “doc”

  • is_q: 0 | 1 = <default>

  • is_share: 0 | 1 = <default>

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_etime”: 事件时间(无效,效果相当于 “user_utime”)

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间(无效,效果相当于 “user_utime”)

    • “user_otime”: 上一次打开时间(无效,效果相当于 “user_utime”)

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • sys_dir: int | str = <default> 💡 系统目录编号,0:最近接收 1:手机相册 2:云下载 3:我的时光记录 4,10,20,21,22,30,40,50,60,70:(未知)

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: 大概相当于 1

    • 15: 图片+视频,相当于 2、4

    • >= 16: 相当于 8

fs_files_app2(payload: None | int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_app2(payload: None | int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息

GET https://proapi.115.com/{app}/files

Caution

这个接口有些问题:

  1. 当 custom_order=1 时,如果设定 limit=1 可能会报错

  2. fc_mix 无论怎么设置,都和 fc_mix=0 的效果相同(即目录总是置顶),设置为 custom_order=2 也没用

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,最大值不一定,看数据量,7,000 应该总是安全的,10,000 有可能报错,但有时也可以 20,000 而成功

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数

  • cur: 0 | 1 = <default> 💡 是否只搜索当前目录

  • custom_order: 0 | 1 | 2 = <default> 💡 启用自定义排序,如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 2

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • for: str = <default> 💡 文件格式,例如 “doc”

  • hide_data: str = <default> 💡 是否返回文件数据

  • is_q: 0 | 1 = <default>

  • is_share: 0 | 1 = <default>

  • min_size: int = 0 💡 (⚠️ 似乎不可用)最小的文件大小

  • max_size: int = 0 💡 (⚠️ 似乎不可用)最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_etime”: 事件时间(无效,效果相当于 “user_utime”)

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间(无效,效果相当于 “user_utime”)

    • “user_otime”: 上一次打开时间(无效,效果相当于 “user_utime”)

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • sys_dir: int | str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: 大概相当于 1

    • 15: 图片+视频,相当于 2、4

    • >= 16: 相当于 8

fs_files_aps(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_aps(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息

GET https://aps.115.com/natsort/files.php

Tip

这个接口的响应速度极快,在文件数特别多时,是 P115Client.fs_files 的数倍甚至数十倍的速度,更无论 P115Client.fs_files_app

Caution

这个函数最多获取任何一种排序条件下的前 1200 + n 条数据(n >= 0 是一个潜在的不定限制)。

o 参数无效,效果只等于 “file_name”,而 fc_mixasc 可用。

offset >= 1200 + n,则相当于 offset=0&fc_mix=1,即从头开始,且置顶项不会置顶

Hint

从技术上来讲最多可分别获取 (1200 + n) * 2 个文件和目录,即你可以通过改变顺序(asc 取 0 或者 1),来最多获取两倍于数量上限的不同条目,然后通过指定 show_dir=0&cur=1show_dir=1&nf=1 来分别只获取文件或目录。

不过对于文件,如果利用 typesuffixmin_sizemax_size 等参数进行筛选,则可以获得更多,甚至可以是全部。

注意:如果有置顶的条目,置顶条目总是出现,因此可能会使获取到的不同条目总数变少。

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,最大值是 1,200

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数

  • cur: 0 | 1 = <default> 💡 是否只搜索当前目录

  • custom_order: 0 | 1 = <default> 💡 启用自定义排序,如果指定了 “asc”、”fc_mix” 中其一,则此参数会被自动设置为 1

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • is_asc: 0 | 1 = <default>

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default>

  • order: str = <default>

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • sys_dir: int | str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-12: 大概相当于 1

    • 13: ???,音频

    • 14-15: 大概相当于 1

    • 16: 字幕

    • 17~98: 大概相当于 1

    • 99: 所有文件

    • >=100: 大概相当于 1

fs_files_blank_document(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_blank_document(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建空白 office 文件

POST https://webapi.115.com/files/blank_document

Payload:
  • file_name: str 💡 文件名,不含后缀

  • pid: int | str = 0 💡 目录 id,对应 parent_id

  • type: 1 | 2 | 3 = 1 💡 1:Word文档(.docx) 2:Excel表格(.xlsx) 3:PPT文稿(.pptx)

fs_files_cover(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_cover(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查看是否有封面

GET https://webapi.115.com/files/cover

Payload:
  • file_id: int | str 💡 文件或目录 id

  • folder_as_file: 0 | 1 = <default>

fs_files_cover_set(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_cover_set(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

是否生成封面

POST https://webapi.115.com/files/cover

Payload:
  • file_id: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • show: 0 | 1 = 1

fs_files_image(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_image(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的图片列表和基本信息

GET https://webapi.115.com/files/imglist

Danger

这个函数大概是有 bug 的,不推荐使用,请用 fs_files_media 代替

Attention

只能获取直属于 cid 所在目录的图片,不会遍历整个目录树

Payload:
  • cid: int | str 💡 目录 id

  • file_id: int | str 💡 不能是 0,可以是任何一个有效的 id(必须在自己网盘中,哪怕已经被删除,此必需参数只为应付检查)

  • limit: int = 32 💡 最多返回数量

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • is_asc: 0 | 1 = <default> 💡 是否升序排列

  • next: 0 | 1 = <default>

  • order: str = <default> 💡 用某字段排序

    • 文件名:”file_name”

    • 文件大小:”file_size”

    • 文件种类:”file_type”

    • 修改时间:”user_utime”

    • 创建时间:”user_ptime”

    • 上一次打开时间:”user_otime”

fs_files_image_app(payload: None | int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_image_app(payload: None | int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的图片列表和基本信息

GET https://proapi.115.com/{app}/files/imglist

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 一页大小,建议控制在 <= 9000,不然会报错

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cur: 0 | 1 = 1 💡 只罗列当前目录

  • o: str = <default> 💡 用某字段排序

    • 文件名:”file_name”

    • 文件大小:”file_size”

    • 文件种类:”file_type”

    • 修改时间:”user_utime”

    • 创建时间:”user_ptime”

    • 上一次打开时间:”user_otime”

fs_files_media(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_media(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息(不含目录)

GET https://webapi.115.com/files/medialist

Attention

有个 bug,当 cid=0&cur=1 时,似乎总是拉到空的文件列表,此时建议换成 client.fs_files({"cid": 0, "cur": 1, "show_dir": 0})

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 一页大小,建议控制在 <= 9000,不然会报错

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cur: 0 | 1 = 1 💡 只罗列当前目录

  • o: str = <default> 💡 用某字段排序

    • 文件名:”file_name”

    • 文件大小:”file_size”

    • 文件种类:”file_type”

    • 修改时间:”user_utime”

    • 创建时间:”user_ptime”

    • 上一次打开时间:”user_otime”

  • type: int = -1 💡 文件类型(不传则视为 4)

    • <0: 全部文件(不含目录),响应中的 “type” 为 0

    • 0: 视为 4,响应中的 “type” 为 4

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: ???,文档

    • 15: 图片+视频,相当于 2、4

    • 16: 字幕

    • 17~98: 大概相当于 1

    • 99: 所有文件

    • >=100: 大概相当于 1

fs_files_media_app(payload: None | int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_media_app(payload: None | int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息(不含目录)

GET https://proapi.115.com/{app}/files/medialist

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 一页大小,建议控制在 <= 9000,不然会报错

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cur: 0 | 1 = 1 💡 只罗列当前目录

  • o: str = <default> 💡 用某字段排序

    • 文件名:”file_name”

    • 文件大小:”file_size”

    • 文件种类:”file_type”

    • 修改时间:”user_utime”

    • 创建时间:”user_ptime”

    • 上一次打开时间:”user_otime”

  • type: int = 💡 文件类型(不传则视为 4)

    • <0: 全部文件(不含目录),响应中的 “type” 为 0

    • 0: 视为 2,因为响应中的 “type” 为 2

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: 大概相当于 1

    • 15: 图片+视频,相当于 2、4

    • >= 16: 相当于 8

fs_files_recent_docs(payload: int | dict = 1000, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_recent_docs(payload: int | dict = 1000, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近上传的文档

POST https://webapi.115.com/files/recent

Todo

这个接口可能支持其它参数,但目前暂未搞清楚

Payload:
  • limit: int

fs_files_recent_docs_app(payload: int | dict = 1000, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_recent_docs_app(payload: int | dict = 1000, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近上传的文档

POST https://proapi.115.com/{app}/2.0/ufile/recent

Todo

这个接口可能支持其它参数,但目前暂未搞清楚

Payload:
  • limit: int

fs_files_second_type(payload: Literal[1, 2, 3, 4, 5, 6, 7] | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_second_type(payload: Literal[1, 2, 3, 4, 5, 6, 7] | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中某个文件类型的扩展名的(去重)列表

GET https://webapi.115.com/files/get_second_type

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • type: int = 1 💡 文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

  • file_label: int | str = <default> 💡 标签 id,多个用逗号 “,” 隔开

fs_files_second_type_app(payload: Literal[1, 2, 3, 4, 5, 6, 7] | dict = 1, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_second_type_app(payload: Literal[1, 2, 3, 4, 5, 6, 7] | dict = 1, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中某个文件类型的扩展名的(去重)列表

GET https://proapi.115.com/{app}/2.0/ufile/get_second_type

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • type: int = 1 💡 文件类型

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

  • file_label: int | str = <default> 💡 标签 id,多个用逗号 “,” 隔开

fs_files_update_app(payload: int | str | tuple[int | str] | list | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files_update_app(payload: int | str | tuple[int | str] | list | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置(若干个)文件或目录(名字、备注、标签等)

POST https://proapi.115.com/{app}/files/update

Payload:
  • file_id: int | str

  • file_id[]: int | str

  • file_id[0]: int | str

  • file_id[1]: int | str

  • file_desc: str = <default> 💡 可以用 html

  • file_label: int | str = <default> 💡 标签 id,多个用逗号 “,” 隔开

  • file_name: str = <default> 💡 文件或目录名

  • fid_cover: int | str = <default> 💡 封面图片的文件 id,多个用逗号 “,” 隔开,如果要删除,值设为 0 即可

  • show_play_long: 0 | 1 = <default> 💡 文件名称显示时长

fs_folder_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录列表(不含文件)

GET https://proapi.115.com/{app}/folder/update

Payload:
  • p_id: int

  • offset: int = 0

  • limit: int = 1150

  • user_id: int | str = <default> 💡 用户 id,不必是自己 🤪

fs_folder_app2(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_app2(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录列表(不含文件)

GET https://proapi.115.com/{app}/folder

Payload:
  • p_id: int

  • offset: int = 0

  • limit: int = 1150

  • user_id: int | str = <default> 💡 用户 id,不必是自己 🤪

  • aid: int = 1

fs_folder_file(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_file(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表(不含目录)

GET https://webapi.115.com/folder/file

Todo

limit 参数无效,即不能设定分页大小,此接口还需继续挖掘 ⛏️

Payload:
  • cid: int | str

  • offset: int = 0

  • limit: int = 1150 💡 ⚠️ 无效,只能是默认获取 15 条

  • user_id: int | str = <default> 💡 用户 id,不必是自己 🤪

  • aid: int = 1

fs_folder_playlong(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_playlong(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录内文件总的播放时长

POST https://aps.115.com/getFolderPlaylong

Payload:
  • folder_ids: int | str 💡 目录 id,多个用逗号 “,” 隔开

fs_folder_playlong_set(ids: int | str | Iterable[int | str], is_set: Literal[0, 1] = 1, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_playlong_set(ids: int | str | Iterable[int | str], is_set: Literal[0, 1] = 1, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

显示或取消目录内文件总的播放时长,此接口是对 fs_batch_edit 的封装

Parameters:
  • ids – 一个或多个文件或目录的 id

  • is_set – 是否显示时长

Returns:

返回成功状态

fs_folder_update_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_update_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置文件或目录,或者创建目录

POST https://proapi.115.com/{app}/folder/update

Note

如果提供了 cidname,则表示对 cid 对应的文件或目录进行改名,否则创建目录

Payload:
  • name: str 💡 名字

  • pid: int | str = 0 💡 在此目录 id 下创建目录

  • aid: int = 1 💡 area_id

  • cid: int = <default> 💡 文件或目录的 id,优先级高于 pid

  • user_id: int | str = <default> 💡 用户 id

fs_folder_update_app2(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_folder_update_app2(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置文件或目录,或者创建目录

POST https://proapi.115.com/{app}/folder

Note

如果提供了 cidname,则表示对 cid 对应的文件或目录进行改名,否则创建目录

Payload:
  • name: str 💡 名字

  • pid: int | str = 0 💡 在此目录 id 下创建目录

  • aid: int = 1 💡 area_id

  • cid: int = <default> 💡 文件或目录的 id,优先级高于 pid

  • user_id: int | str = <default> 💡 用户 id

fs_hidden_switch(payload: bool | int | str | dict = False, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_hidden_switch(payload: bool | int | str | dict = False, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

切换隐藏模式

POST https://115.com/?ct=hiddenfiles&ac=switching

Tip

开启隐藏模式时,需要提供安全密钥,关闭时则不需要

Tip

这个接口必须提供安全密钥。如果不提供,则默认使用 “000000”,在不必要的情况下,完全可以把安全密钥设为这个值

Note

这个接口会返回一个 “token” 字段,可以提供给某些接口,作为通过安全密钥验证的凭证

Payload:
  • safe_pwd: str = “000000” 💡 安全密钥

  • show: 0 | 1 = <default> 💡 是否开启隐藏模式:0:关闭 1:开启

  • valid_type: int = <default>

fs_hidden_switch_app(payload: bool | int | str | dict = False, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_hidden_switch_app(payload: bool | int | str | dict = False, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

切换隐藏模式

GET https://proapi.115.com/{app}/files/hiddenswitch

Note

可以在设置中的【账号安全/安全密钥】页面下,关闭【文件(隐藏模式/清空删除回收站)】的按钮,就不需要传安全密钥了

Payload:
  • safe_pwd: str = “000000” 💡 安全密钥,值为实际安全密钥的 md5 哈希值

  • show: 0 | 1 = <default> 💡 是否开启隐藏模式:0:关闭 1:开启

  • token: str = <default> 💡 令牌,调用 P115client.user_security_key_check() 获得,可以不传

fs_hide(payload: int | str | Iterable[int | str] | dict, /, hidden: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_hide(payload: int | str | Iterable[int | str] | dict, /, hidden: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

隐藏或者取消隐藏某些文件或目录

POST https://webapi.115.com/files/hiddenfiles

Payload:
  • fid[0]: int | str

  • fid[1]: int | str

  • hidden: 0 | 1 = 1

fs_hide_app(payload: int | str | Iterable[int | str] | dict, /, hidden: bool = True, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_hide_app(payload: int | str | Iterable[int | str] | dict, /, hidden: bool = True, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

隐藏或者取消隐藏某些文件或目录

POST https://proapi.115.com/{app}/files/hiddenfiles

Payload:
  • fid: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • hidden: 0 | 1 = 1

fs_history(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件的观看历史,主要用于视频

GET https://webapi.115.com/files/history

Payload:
  • pick_code: str

  • fetch: str = “one”

  • category: int = 1 💡 类型:1:视频 3:音频

  • share_id: int | str = <default>

fs_history_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取历史记录

GET https://proapi.115.com/{app}/history

Payload:
  • pick_code: str

  • fetch: str = “one”

  • category: int = 1

  • share_id: int | str = <default>

fs_history_clean(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_clean(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

清空历史记录

POST https://webapi.115.com/history/clean

Payload:
  • type: int | str = 0 💡 类型(??表示还未搞清楚),多个用逗号 “,” 隔开

    • 全部: 0

    • ??: 1(大概和接收有关)

    • 云下载: 2

    • 播放视频: 3

    • 上传: 4

    • ??: 5

    • ??: 6(大概和名称冲突有关)

    • 接收: 7

    • 移动: 8

  • with_file: 0 | 1 = 0 💡 是否同时删除文件

fs_history_clean_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_clean_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

清空历史记录

POST https://proapi.115.com/{app}/history/clean

Payload:
  • type: int | str = 0 💡 类型(??表示还未搞清楚),多个用逗号 “,” 隔开

    • 全部: 0

    • ??: 1(大概和接收有关)

    • 云下载: 2

    • 播放视频: 3

    • 上传: 4

    • ??: 5

    • ??: 6(大概和名称冲突有关)

    • 接收: 7

    • 移动: 8

  • with_file: 0 | 1 = 0

fs_history_delete(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_delete(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除历史记录

POST https://webapi.115.com/history/delete

Payload:
  • id: int | str 💡 多个用逗号 “,” 隔开

  • type: int = 0

  • with_file: 0 | 1 = 0

fs_history_delete_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_delete_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除历史记录

POST https://proapi.115.com/{app}/history/delete

Payload:
  • id: int | str 💡 多个用逗号 “,” 隔开

  • with_file: 0 | 1 = 0

fs_history_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

历史记录列表

GET https://webapi.115.com/history/list

Payload:
  • offset: int = 0

  • limit: int = 1150

  • order: str = <default>

  • played_end: 0 | 1 = <default> 💡 是否已经播放完

  • search_value: str = “”

  • type: int = <default> 💡 类型(??表示还未搞清楚),多个用逗号 “,” 隔开

    • 全部: 0

    • ??: 1(大概和接收有关)

    • 云下载: 2

    • 播放视频: 3

    • 上传: 4

    • ??: 5

    • ??: 6(大概和名称冲突有关)

    • 接收: 7

    • 移动: 8

fs_history_list_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_list_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

历史记录列表

GET https://proapi.115.com/{app}/history/list

Payload:
  • offset: int = 0

  • limit: int = 1150

  • played_end: 0 | 1 = <default>

  • type: int = <default> 💡 类型(??表示还未搞清楚),多个用逗号 “,” 隔开

    • 全部: 0

    • ??: 1(大概和接收有关)

    • 云下载: 2

    • 播放视频: 3

    • 上传: 4

    • ??: 5

    • ??: 6(大概和名称冲突有关)

    • 接收: 7

    • 移动: 8

fs_history_move_target_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_move_target_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

最近移动记录

GET https://webapi.115.com/history/move_target_list

Tip

使用这个方法,甚至可以随时获取近期有文件移入的目录,可以部分代替 115 生活的移动事件的使用

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 1150 💡 分页大小,最大值不一定,看数据量,7,000 应该总是安全的,10,000 有可能报错,但有时也可以 20,000 而成功

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • custom_order: 0 | 1 | 2 = <default> 💡 是否使用记忆排序。如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 2

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_etime”: 事件时间(无效,效果相当于 “user_utime”)

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间(无效,效果相当于 “user_utime”)

    • “user_otime”: 上一次打开时间(无效,效果相当于 “user_utime”)

  • qid: int = <default>

  • search_value: str = <default> 💡 搜索文本

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

fs_history_receive_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_receive_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

接收列表

GET https://webapi.115.com/history/receive_list

Payload:
  • offset: int = 0

  • limit: int = 1150

fs_history_receive_list_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_receive_list_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

接收列表

GET https://proapi.115.com/{app}/history/receive_list

Payload:
  • offset: int = 0

  • limit: int = 1150

fs_history_rename_list(payload: int | str | Iterable[int | str] | dict, /, method: str = 'POST', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_rename_list(payload: int | str | Iterable[int | str] | dict, /, method: str = 'POST', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

重命名历史记录

POST https://webapi.115.com/history/renamelist

Payload:
  • file_ids: int | str 💡 文件 id,多个用逗号 “,” 隔开

  • offset: int = 0

  • limit: int = <default>

  • type: int = <default>

fs_history_rename_list_app(payload: int | str | Iterable[int | str] | dict, /, method: str = 'POST', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_rename_list_app(payload: int | str | Iterable[int | str] | dict, /, method: str = 'POST', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

重命名历史记录

POST https://proapi.115.com/files/history/renamelist

Payload:
  • file_ids: int | str 💡 文件 id,多个用逗号 “,” 隔开

  • offset: int = 0

  • limit: int = <default>

  • type: int = <default>

fs_history_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

更新文件的观看历史,主要用于视频和音频

POST https://webapi.115.com/files/history

Payload:
  • pick_code: str 💡 文件的提取码

  • op: str = “update” 💡 操作类型,具体有哪些还需要再研究

  • category: int = 1 💡 类型:1:视频 3:音频

  • definition: int = <default> 💡 视频清晰度

  • share_id: int | str = <default>

  • time: int = <default> 💡 播放时间点(用来向服务器同步播放进度)

  • watch_end: int = <default> 💡 视频是否播放播放完毕 0:未完毕 1:完毕

  • …(其它未找全的参数)

fs_history_set_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_history_set_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

更新文件的观看历史,主要用于视频

POST https://proapi.115.com/{app}/history

Payload:
  • pick_code: str 💡 文件的提取码

  • op: str = “update” 💡 操作类型,具体有哪些还需要再研究

  • category: int = 1

  • definition: int = <default> 💡 视频清晰度

  • share_id: int | str = <default>

  • time: int = <default> 💡 播放时间点(用来向服务器同步播放进度)

  • watch_end: int = <default> 💡 视频是否播放播放完毕 0:未完毕 1:完毕

  • …(其它未找全的参数)

fs_image(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_image(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取图片的各种链接

GET https://webapi.115.com/files/image

Payload:
  • pickcode: str 💡 同 pick_code,优先级较高

  • pick_code: str 💡 同 pickcode

  • share_id: int | str = <default>

fs_imagedata(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://imgjump.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_imagedata(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://imgjump.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取图片的分辨率等信息

POST https://imgjump.115.com/getimgdata_url

Payload:
  • imgurl: str 💡 图片的访问链接

fs_index_info(payload: Literal[0, 1] | bool | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_index_info(payload: Literal[0, 1] | bool | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前已用空间、可用空间、登录设备等信息

GET https://webapi.115.com/files/index_info

Payload:
  • count_space_nums: 0 | 1 = 0 💡 是否获取明细:0:包含各种类型文件的数量统计 1:包含登录设备列表

fs_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

显示属性,可获取文件或目录的统计信息(提示:但得不到根目录的统计信息,所以 cid 为 0 时无意义)

GET https://webapi.115.com/category/get

Caution

尝试获取目录的信息时,会去计算目录中文件和目录的数量、总文件大小 等信息,可能会消耗大量时间,但短时间内再次查询同一目录,耗时可能会大大减小

Payload:
  • cid: int | str

  • fid: int | str 💡 cidfid 至少需要提供一个

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • status: 0 | 1 = <default> 💡 如果为 1,那么文件已被删除,会返回错误

fs_info_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

显示属性,可获取文件或目录的统计信息(提示:但得不到根目录的统计信息,所以 cid 为 0 时无意义)

GET https://proapi.115.com/{app}/2.0/category/get

Caution

尝试获取目录的信息时,会去计算目录中文件和目录的数量、总文件大小 等信息,可能会消耗大量时间,但短时间内再次查询同一目录,耗时可能会大大减小

Payload:
  • cid: int | str

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

fs_label_add(payload: str | Iterable[str] | dict | list[tuple], /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_add(payload: str | Iterable[str] | dict | list[tuple], /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加标签(可以接受多个)

POST https://webapi.115.com/label/add_multi

Payload:
  • name: str 💡 格式为 “{label_name}” 或 “{label_name}{color}”,例如 “tag#FF0000”(中间有个 “x07”)

  • name[]: str

fs_label_add_app(payload: str | Iterable[str] | dict | list[tuple], /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_add_app(payload: str | Iterable[str] | dict | list[tuple], /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加标签(可以接受多个)

POST https://proapi.115.com/{app}/label/add_multi

Payload:
  • name: str 💡 格式为 “{label_name}” 或 “{label_name}{color}”,例如 “tag#FF0000”(中间有个 “x07”)

  • name[]: str

fs_label_batch(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_batch(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量设置标签

POST https://webapi.115.com/files/batch_label

Payload:
  • action: “add” | “remove” | “reset” | “replace” 💡 操作名

    • “add”: 添加

    • “remove”: 移除

    • “reset”: 重设

    • “replace”: 替换

  • file_ids: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • file_label: int | str = <default> 💡 标签 id,多个用逗号 “,” 隔开

  • file_label[{file_label}]: int | str = <default> 💡 action 为 replace 时使用此参数,file_label[{原标签id}]: {目标标签id},例如 file_label[123]: 456,就是把 id 是 123 的标签替换为 id 是 456 的标签

fs_label_batch_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_batch_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量设置标签

POST https://proapi.115.com/{app}/files/batch_label

Payload:
  • action: “add” | “remove” | “reset” | “replace” 💡 操作名

    • “add”: 添加

    • “remove”: 移除

    • “reset”: 重设

    • “replace”: 替换

  • file_ids: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • file_label: int | str = <default> 💡 标签 id,多个用逗号 “,” 隔开

  • file_label[{file_label}]: int | str = <default> 💡 action 为 replace 时使用此参数,file_label[{原标签id}]: {目标标签id},例如 file_label[123]: 456,就是把 id 是 123 的标签替换为 id 是 456 的标签

fs_label_del(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_del(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除标签

POST https://webapi.115.com/label/delete

Payload:
  • id: int | str 💡 标签 id,多个用逗号 “,” 隔开

fs_label_del_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_del_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除标签

POST https://proapi.115.com/{app}/label/delete

Payload:
  • id: int | str 💡 标签 id,多个用逗号 “,” 隔开

fs_label_edit(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_edit(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

编辑标签

POST https://webapi.115.com/label/edit

Payload:
  • id: int | str 💡 标签 id

  • name: str = <default> 💡 标签名

  • color: str = <default> 💡 标签颜色,支持 css 颜色语法

  • sort: int = <default> 💡 序号

fs_label_edit_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_edit_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

编辑标签

POST https://proapi.115.com/{app}/label/edit

Payload:
  • id: int | str 💡 标签 id

  • name: str = <default> 💡 标签名

  • color: str = <default> 💡 标签颜色,支持 css 颜色语法

  • sort: int = <default> 💡 序号

fs_label_files(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_files(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列标签的文件列表

GET https://webapi.115.com/label/files

Payload:
  • label_id: int

  • offset: 0

  • limit: int = 1150

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • cid: int | str = 0 💡 目录 id

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数

  • cur: 0 | 1 = <default> 💡 是否只显示当前目录

  • custom_order: 0 | 1 | 2 = <default> 💡 是否使用记忆排序。如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 2

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • fields: str = <default>

  • for: str = <default> 💡 文件格式,例如 “doc”

  • is_q: 0 | 1 = <default>

  • is_share: 0 | 1 = <default>

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_etime”: 事件时间(无效,效果相当于 “user_utime”)

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间(无效,效果相当于 “user_utime”)

    • “user_otime”: 上一次打开时间(无效,效果相当于 “user_utime”)

  • qid: int = <default>

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: ???,文档

    • 15: 图片+视频,相当于 2、4

    • 16: 字幕

    • 17~98: 大概相当于 1

    • 99: 所有文件

    • >=100: 大概相当于 1

fs_label_list(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_list(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列标签列表(如果要获取做了标签的文件列表,用 fs_search 接口)

GET https://webapi.115.com/label/list

Payload:
  • offset: int = 0 💡 索引偏移,从 0 开始

  • limit: int = 11500 💡 最多返回数量

  • keyword: str = <default> 💡 搜索关键词

  • sort: “name” | “update_time” | “create_time” = <default> 💡 排序字段

    • 名称: “name”

    • 添加时间: “create_time”

    • 修改时间: “update_time”

  • order: “asc” | “desc” = <default> 💡 排序顺序:”asc”(升序), “desc”(降序)

  • count_file: 0 | 1 = <default>

fs_label_list_app(payload: str | dict = '', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_list_app(payload: str | dict = '', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列标签列表(如果要获取做了标签的文件列表,用 fs_search 接口)

GET https://proapi.115.com/{app}/label/list

Payload:
  • offset: int = 0 💡 索引偏移,从 0 开始

  • limit: int = 11500 💡 最多返回数量

  • keyword: str = <default> 💡 搜索关键词

  • sort: “name” | “update_time” | “create_time” = <default> 💡 排序字段

    • 名称: “name”

    • 创建时间: “create_time”

    • 更新时间: “update_time”

  • order: “asc” | “desc” = <default> 💡 排序顺序:”asc”(升序), “desc”(降序)

fs_label_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, label: int | str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, label: int | str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置标签,此接口是对 fs_edit 的封装

Attention

这个接口会把标签列表进行替换,而不是追加

Hint

为单个文件或目录,设置一个不存在的标签 id,比如 1,会清空标签,但可产生事件(批量设置时无事件,可能是 bug)

client.fs_label_set(id, 1)
fs_label_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, label: int | str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_label_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, label: int | str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置标签,此接口是对 fs_files_update_app 的封装

Attention

这个接口会把标签列表进行替换,而不是追加

fs_makedirs(payload: str | dict, /, pid: int | str = 0, *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_makedirs(payload: str | dict, /, pid: int | str = 0, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建目录(会尝试创建所有的中间节点)

Note

  1. 此接口是对 fs_dir_getid2 的封装

  2. 目录层级最多 25 级(不算文件节点的话)

  3. 名字不能包含 3 个字符之一 “<>,如果包含,则会被替换为 _

  4. 单个目录内最多 5 万个文件(用网页上传、创建 Office 文档此限制)

Attention

这个方法并不产生 115 生活的操作事件

Payload:
  • path: str

  • parent_id: int | str = 0

fs_makedirs_app(payload: str | dict, /, pid: int | str = 0, app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_makedirs_app(payload: str | dict, /, pid: int | str = 0, app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建目录(会尝试创建所有的中间节点)

POST https://proapi.115.com/app/chrome/add_path

Note

  1. 目录层级最多 25 级(不算文件节点的话)

  2. 名字不能包含 3 个字符之一 “<>,如果包含,则会被替换为 _

  3. 单个目录内最多 5 万个文件(用网页上传、创建 Office 文档此限制)

Attention

这个方法并不产生 115 生活的操作事件

Payload:
  • path: str

  • parent_id: int | str = 0

fs_mkdir(payload: str | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_mkdir(payload: str | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建目录

POST https://webapi.115.com/files/add

Note

  1. 目录层级最多 25 级(不算文件节点的话)

  2. 名字不能包含 3 个字符之一 “<>,但是文件可以通过上传来突破此限制

  3. 单个目录内最多 5 万个文件(用网页上传、创建 Office 文档此限制)

Payload:
  • cname: str 💡 新建目录名称,限制 255 个字符

  • pid: int | str = 0 💡 上级目录的 id

fs_mkdir_app(payload: dict | str, /, pid: int | str = 0, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_mkdir_app(payload: dict | str, /, pid: int | str = 0, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建目录,此接口是对 fs_folder_update_app 的封装

Payload:
  • name: str 💡 新建目录名称,限制 255 个字符

  • pid: int | str = 0 💡 上级目录的 id

fs_move(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_move(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

移动文件或目录

POST https://webapi.115.com/files/move

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Caution

你可以把文件或目录移动到其它目录 id 下,即使是不存在的 id

因此,我定义了一个概念,悬空节点,此节点的 aid=1,但它有一个祖先节点,要么不存在,要么 aid != 1

你可以用 P115Client.tool_space() 方法,使用【校验空间】功能,把所有悬空节点找出来,放到根目录下的【修复文件】目录,此接口一天只能用一次

Payload:
  • fid: int | str 💡 文件或目录 id,只接受单个 id

  • fid[]: int | str

  • fid[0]: int | str

  • fid[1]: int | str

  • pid: int | str = 0 💡 目标目录 id

  • move_proid: str = <default> 💡 任务 id

  • conflict_policy: str = <default>

fs_move_app(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_move_app(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

移动文件或目录

POST https://proapi.115.com/{app}/files/move

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • ids: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • to_cid: int | str 💡 目标目录 id

  • user_id: int | str = <default> 💡 用户 id

fs_move_check_conflict(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_move_check_conflict(payload: int | str | dict | Iterable[int | str], /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检查移动文件或目录时,是否有冲突

POST https://webapi.115.com/files/move_check_conflict

Payload:
  • move_fids: int | str 💡 文件或目录 id,只接受单个 id

  • move_fids[]: int | str

  • move_fids[0]: int | str

  • move_fids[1]: int | str

  • pid: int | str = 0 💡 目标目录 id

fs_move_progress(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_move_progress(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

移动任务的进度

GET https://webapi.115.com/files/move_progress

Payload:
  • move_proid: str = <default> 💡 任务 id

fs_music(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取音乐信息(其实只有一个下载链接)

GET https://webapi.115.com/files/music

Payload:
  • pickcode: str 💡 提取码

  • topic_id: int = <default>

  • music_id: int = <default>

  • download: int = <default>

  • platform: str = <default> 💡 如果取值为 “weixin”,则会多一个字段 “audio_url”

  • share_id: int | str = 0

fs_music_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取音乐信息

GET https://proapi.115.com/{app}/music/musicplay

Note

即使文件格式不正确或者过大(超过 200 MB),也可返回一些信息(包括 parent_id),但如果是目录则信息匮乏(但由此也可判定一个目录)

Payload:
  • pickcode: str 💡 提取码

  • music_id: int = <default>

  • topic_id: int = <default>

fs_music_file_exist(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_file_exist(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检查音乐文件是否存在

GET https://webapi.115.com/files/music_file_exist

Payload:
  • pickcode: str 💡 提取码

  • topic_id: int = <default>

  • music_id: int = <default>

  • download: int = <default>

fs_music_fond_list(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_fond_list(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列星标听单

GET https://webapi.115.com/files/music_fond_list

fs_music_fond_list_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_fond_list_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列星标听单

GET https://proapi.115.com/{app}/music/music_fond_list

fs_music_fond_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_fond_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

给听单加减星标

POST https://webapi.115.com/files/music_topic_fond

Payload:
  • topic_id: int

  • fond: 0 | 1 = 1

fs_music_include_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_include_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

包含音乐的目录列表(专属文件)

GET https://webapi.115.com/files/include_music_list

Payload:
  • asc: 0 | 1 = 0

  • limit: int = 1150

  • offset: int = 0

  • order: str = “user_etime”

fs_music_include_list_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_include_list_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

包含音乐的目录列表(专属文件)

GET https://proapi.115.com/{app}/music/include_music_list

Payload:
  • asc: 0 | 1 = 0

  • limit: int = 1150

  • offset: int = 0

  • order: str = “user_etime”

fs_music_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取音乐封面等信息

GET https://webapi.115.com/files/music_info

Payload:
  • pickcode: str 💡 提取码

fs_music_info_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_info_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取音乐封面等信息

GET https://proapi.115.com/{app}/music/musicdetail

Payload:
  • pickcode: str 💡 提取码

fs_music_list(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_list(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列听单中的文件

GET https://webapi.115.com/files/music_list

Payload:
  • topic_id: int = 1 💡 听单 id。-1:星标 1:最近听过 2:最近接收

  • start: int = 0

  • limit: int = 1150

fs_music_list_app(payload: int | dict = 1, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_list_app(payload: int | dict = 1, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列听单中的文件

GET https://proapi.115.com/{app}/music/music_list

Payload:
  • topic_id: int = 1 💡 听单 id。-1:星标 1:最近听过 2:最近接收

  • start: int = 0

  • limit: int = 1150

fs_music_new(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_new(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列听单或听单中的文件

GET https://webapi.115.com/files/musicnew

Payload:
  • topic_id: int = 1 💡 听单 id。-1:星标 1:最近听过 2:最近接收

  • type: 0 | 1 = 0 💡 类型:0:文件 1:目录

  • start: int = 0

  • limit: int = 1150

fs_music_new_app(payload: int | dict = 1, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_new_app(payload: int | dict = 1, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列听单或听单中的文件

GET https://proapi.115.com/{app}/music/musicnew

Payload:
  • topic_id: int = 1 💡 听单 id。-1:星标 1:最近听过 2:最近接收

  • type: 0 | 1 = 0 💡 类型:0:文件 1:目录

fs_music_set(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_set(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

从听单添加或移除音乐,或者给音乐加减星标

POST https://webapi.115.com/files/music

Caution

文件超过500MB,暂不支持添加到我听

Payload:
  • file_id: int 💡 文件 id,多个用逗号 “,” 隔开(op 为 “add” 和 “delete” 时需要)

  • music_id: int = 1 💡 音乐 id(op 为 “fond” 时需要)

  • topic_id: int = 1 💡 听单 id,默认为【最近听过】

  • op: str = “add” 💡 操作类型:”add”: 添加到听单, “delete”: 从听单删除, “fond”: 设置星标

  • fond: 0 | 1 = 1 💡 是否星标(op 为 “fond” 时需要),这个星标和 music_id 有关,和 file_id 无关

fs_music_status(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_status(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

音乐状态

GET https://webapi.115.com/files/music_status

Payload:
  • pickcode: str 💡 提取码

fs_music_topic_listnew(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_topic_listnew(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列听单

GET https://webapi.115.com/files/music_topic_listnew

Caution

似乎查询参数并没有效果

Payload:
  • fond: 0 | 1 = 0 💡 是否星标

  • start: int = 0 💡 开始索引

  • limit: int = 1150 💡 最多返回数量

  • hidden: 0 | 1 = 0

fs_music_topic_listnew_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_topic_listnew_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列听单

GET https://proapi.115.com/{app}/music/musiclistnew

Caution

似乎查询参数并没有效果

Payload:
  • fond: 0 | 1 = 0 💡 是否星标

  • start: int = 0 💡 开始索引

  • limit: int = 1150 💡 最多返回数量

fs_music_topic_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_music_topic_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改听单

POST https://webapi.115.com/files/music_topic

Payload:
  • op: “edit” | “delete” | “add” 💡 操作类型:”edit”:改名 “delete”:删除 “add”:添加

  • topic_id: int = <default> 💡 听单 id(op 不为 “add” 时需要)

  • topic_name: str = <default> 💡 听单名字(op 为 “add” 和 “edit” 时需要)

fs_office_check_complete(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_office_check_complete(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检查 office 保存任务完成情况

POST https://webapi.115.com/files/office?act=check_complete

Payload:
  • office_id: int | str

fs_office_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_office_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

初始化 office

POST https://webapi.115.com/files/office?act=office_init

Payload:
  • pickcode: str

fs_office_save(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_office_save(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

保存 office,即提交一个 office 的保存任务

POST https://webapi.115.com/files/office?act=save

Todo

临时数据需要经过 AES-128 加密,并用 WPS 的(类似如下)接口提交,以后等需要用到了再进行破解

https://kmon.kdocs.cn/api/relay/store/57QKSwAPhwr/log

Caution

用 office 来编辑文件,可以在 id 不变的情况下,修改文件数据,打破了文件一旦上传完成,内容就不会改变的固有认知

Payload:
  • office_id: int | str

fs_order_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_order_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置某个目录内文件的默认排序

POST https://webapi.115.com/files/order

Payload:
  • user_order: str 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • file_id: int | str = 0 💡 目录 id,对应 parent_id

  • user_asc: 0 | 1 = <default> 💡 是否升序排列

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • module: str = <default> 💡 “label_search” 表示用于搜索的排序

fs_order_set_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_order_set_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置某个目录内文件的默认排序

POST https://proapi.115.com/{app}/2.0/ufile/order

Error

这个接口暂时并不能正常工作,应该是参数构造有问题,暂时请用 P115Client.fs_order_set()

Payload:
  • user_order: str 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • file_id: int | str = 0 💡 目录 id,对应 parent_id

  • user_asc: 0 | 1 = <default> 💡 是否升序排列

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • module: str = <default> 💡 “label_search” 表示用于搜索的排序

fs_preview(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_preview(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

文档预览

POST https://webapi.115.com/files/preview

Payload:
  • pickcode: str 💡 提取码

  • share_id: int | str = <default>

fs_rename(payload: tuple[int | str, str] | dict | Iterable[tuple[int | str, str]], /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_rename(payload: tuple[int | str, str] | dict | Iterable[tuple[int | str, str]], /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

重命名文件或目录

POST https://webapi.115.com/files/batch_rename

Caution

改名时,虽然不能修改扩展名,但是一定要带上扩展名(无论是啥),不然会把最后一个句点 . 及其之后文字截断

Payload:
  • files_new_name[{file_id}]: str 💡 值为新的文件名(basename)

fs_rename_app(payload: tuple[int | str, str] | dict | Iterable[tuple[int | str, str]], /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_rename_app(payload: tuple[int | str, str] | dict | Iterable[tuple[int | str, str]], /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

重命名文件或目录

POST https://proapi.115.com/{app}/files/batch_rename

Caution

改名时,虽然不能修改扩展名,但是一定要带上扩展名(无论是啥),不然会把最后一个句点 . 及其之后文字截断

Payload:
  • files_new_name[{file_id}]: str 💡 值为新的文件名(basename)

fs_rename_reset_names(payload: dict | list[tuple[str, str | int]], /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_rename_reset_names(payload: dict | list[tuple[str, str | int]], /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取批量重命名的模拟结果(提示:较为复杂,自己抓包研究)

POST https://aps.115.com/rename/reset_names.php

fs_rename_set_names(payload: dict | list[tuple[str, str | int]], /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_rename_set_names(payload: dict | list[tuple[str, str | int]], /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

提交模拟批量重命名请求(提示:较为复杂,自己抓包研究)

POST https://aps.115.com/rename/set_names.php

fs_repeat_sha1(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_repeat_sha1(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查找重复文件(罗列除此以外的 sha1 相同的文件)

GET https://webapi.115.com/files/get_repeat_sha

Payload:
  • file_id: int | str

  • offset: int = 0

  • limit: int = 1150

  • source: str = “”

fs_repeat_sha1_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_repeat_sha1_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查找重复文件(罗列除此以外的 sha1 相同的文件)

GET https://proapi.115.com/{app}/2.0/ufile/get_repeat_sha

Payload:
  • file_id: int | str

  • offset: int = 0

  • limit: int = 1150

  • source: str = “”

fs_score_set(file_id: int | str | Iterable[int | str], /, score: int = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_score_set(file_id: int | str | Iterable[int | str], /, score: int = 0, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

给文件或目录评分

POST https://webapi.115.com/files/score

Payload:
  • file_id: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • score: int | str = 0 💡 任意整数,<= 0 时网页上不会显示星星,如果是字符串,会尝试解析为整数,失败的话得到 0

fs_search(payload: str | dict = '.', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

搜索文件或目录

GET https://webapi.115.com/files/search

Attention

最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000,不过可以一次性取完

不过就算正确设置了 limitoffset,并且总数据量大于 limit + offset,可能也不足 limit,这应该是 bug,也就是说,就算数据总量足够你也取不到足量

它返回数据中的 count 字段的值表示总数据量(即使你只能取前 10,000 条),往往并不准确,最多能当作一个可参考的估计值

这个接口实际上不支持在查询中直接设置排序,只能由 P115Client.fs_order_set() 设置

Note

搜索接口甚至可以把上级 id 关联错误的文件或目录都搜索出来。一般是因为把文件或目录移动到了一个不存在的 id 下,你可以用某些关键词把他们搜索出来,然后移动到一个存在的目录中,就可以恢复他们了,或者使用 P115Client.tool_space() 接口来批量恢复

Important

一般使用的话,要提供 “search_value” 或 “file_label”,不然返回数据里面看不到任何一条数据,即使你指定了其它参数

下面指定的很多参数其实是一点效果都没有的,具体可以实际验证

Payload:
  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • count_folders: 0 | 1 = <default> 💡 是否统计目录数,这样就会增加 “folder_count” 和 “file_count” 字段作为统计

  • date: str = <default> 💡 筛选日期,格式为 YYYY-MM-DD(或者 YYYY-MM 或者 YYYY 或者 时间戳(限定在当天)),最小单位是天,其次是月,具体可以看文件信息中的 “t” 字段的值

  • distance: int | str = <default>

  • fc: 0 | 1 = <default> 💡 只显示文件或目录。1:只显示目录 2:只显示文件

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • file_label: int | str = <default> 💡 标签 id

  • gte_day: str 💡 搜索结果匹配的开始时间;格式:YYYY-MM-DD

  • limit: int = 32 💡 一页大小,意思就是 page_size

  • location: str = <default>

  • lte_day: str 💡 搜索结果匹配的结束时间;格式:YYYY-MM-DD

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录)

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • qid: int | str = <default>

  • resp_ver: int | str = <default>

  • search_value: str = “.” 💡 搜索文本,可以是 sha1

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • source: str = <default> 💡 来源

  • star: 0 | 1 = <default> 💡 是否打星标

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 文件后缀(扩展名),优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 99: 所有文件

fs_search_app(payload: str | dict = '.', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_search_app(payload: str | dict = '.', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

搜索文件或目录

GET https://proapi.115.com/{app}/2.0/ufile/search

Attention

最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000,不过可以一次性取完

不过就算正确设置了 limitoffset,并且总数据量大于 limit + offset,可能也不足 limit,这应该是 bug,也就是说,就算数据总量足够你也取不到足量

它返回数据中的 count 字段的值表示总数据量(即使你只能取前 10,000 条),往往并不准确,最多能当作一个可参考的估计值

Payload:
  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cid: int | str = 0 💡 目录 id。cid=-1 时,表示不返回列表任何内容

  • count_folders: 0 | 1 = <default>

  • date: str = <default> 💡 筛选日期,格式为 YYYY-MM-DD(或者 YYYY-MM 或者 YYYY 或者 时间戳(限定在当天)),最小单位是天,其次是月,具体可以看文件信息中的 “t” 字段的值

  • fc: 0 | 1 = <default> 💡 只显示文件或目录。1:只显示目录 2:只显示文件

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • file_label: int | str = <default> 💡 标签 id

  • gte_day: str 💡 搜索结果匹配的开始时间;格式:YYYY-MM-DD

  • limit: int = 32 💡 一页大小,意思就是 page_size

  • lte_day: str 💡 搜索结果匹配的结束时间;格式:YYYY-MM-DD

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • search_value: str = “.” 💡 搜索文本,可以是 sha1

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 99: 所有文件

  • version: str = <default> 💡 版本号,比如 3.1

fs_search_app2(payload: str | dict = '.', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_search_app2(payload: str | dict = '.', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

搜索文件或目录

GET https://proapi.115.com/{app}/files/search

Attention

最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000,不过可以一次性取完

不过就算正确设置了 limitoffset,并且总数据量大于 limit + offset,可能也不足 limit,这应该是 bug,也就是说,就算数据总量足够你也取不到足量

它返回数据中的 count 字段的值表示总数据量(即使你只能取前 10,000 条),往往并不准确,最多能当作一个可参考的估计值

Payload:
  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cid: int | str = 0 💡 目录 id。cid=-1 时,表示不返回列表任何内容

  • count_folders: 0 | 1 = <default>

  • date: str = <default> 💡 筛选日期,格式为 YYYY-MM-DD(或者 YYYY-MM 或者 YYYY 或者 时间戳(限定在当天)),最小单位是天,其次是月,具体可以看文件信息中的 “t” 字段的值

  • fc: 0 | 1 = <default> 💡 只显示文件或目录。1:只显示目录 2:只显示文件

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • file_label: int | str = <default> 💡 标签 id

  • gte_day: str 💡 搜索结果匹配的开始时间;格式:YYYY-MM-DD

  • limit: int = 32 💡 一页大小,意思就是 page_size

  • lte_day: str 💡 搜索结果匹配的结束时间;格式:YYYY-MM-DD

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • search_value: str = “.” 💡 搜索文本,可以是 sha1

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 99: 所有文件

  • version: str = <default> 💡 版本号,比如 3.1

fs_shasearch(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_shasearch(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

通过 sha1 搜索文件

GET https://webapi.115.com/files/shasearch

Note

这是个非常早期的接口,高级功能请直接使用 client.fs_search。这个方法最多只能获得一条记录,并且不支持指定搜索目录,而且当未搜索到时,返回的信息为 ‘{“state”: false, “error”: “文件错误”}’

Payload:
  • sha1: str

fs_show_play_long_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, show: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_show_play_long_set(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, show: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为目录设置显示时长,此接口是对 fs_edit 的封装

fs_show_play_long_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, show: bool = True, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_show_play_long_set_app(payload: int | str | Iterable[int | str] | list[tuple] | dict, /, show: bool = True, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为目录设置显示时长,此接口是对 fs_files_update_app 的封装

fs_space_report(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_space_report(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取数据报告(截至月末数据,分组聚合)

GET https://webapi.115.com/user/report

Payload:
  • month: str 💡 年月,格式为 YYYYMM

fs_space_summury(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_space_summury(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取数据报告(当前数据,分组聚合,但并不精确)

POST https://webapi.115.com/user/space_summury

fs_star_set(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_star_set(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置或取消星标

POST https://webapi.115.com/files/star

Note

如果其中任何一个 id 目前已经被删除,则会直接返回错误信息

Payload:
  • file_id: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • star: 0 | 1 = 1

fs_star_set_app(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_star_set_app(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置或取消星标

POST https://proapi.115.com/{app}/files/star

Note

如果其中任何一个 id 目前已经被删除,则会直接返回错误信息

Payload:
  • ids: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • star: 0 | 1 = 1

  • user_id: int | str = <default> 💡 用户 id

fs_storage_info(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_storage_info(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取使用空间的统计数据(最简略,如需更详细,请用 fs.user_space_info()

GET https://115.com/index.php?ct=ajax&ac=get_storage_info

fs_supervision(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_supervision(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

通过 pickcode 获取文件信息

POST https://webapi.115.com/files/supervision

Payload:
  • pickcode: str

  • preview_type: str = “file” 💡 file:文件 doc:文档 video:视频 music:音乐 pic:图片

  • module: int = 10

  • share_id: int | str = <default>

fs_supervision_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_supervision_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

通过 pickcode 获取文件信息

POST https://proapi.115.com/{app}/files/supervision

Payload:
  • pickcode: str

  • preview_type: str = “file” 💡 file:文件 doc:文档 video:视频 music:音乐 pic:图片

  • module: int = 10

  • share_id: int | str = <default>

fs_sys_dir(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_sys_dir(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取系统目录(在根目录下,使用 fs_files 接口罗列时,数目体现在返回值的 sys_count 字段)

GET https://proapi.115.com/{app}/files/getpackage

Payload:
  • sys_dir: int 💡 0:最近接收 1:手机相册 2:云下载 3:我的时光记录 4,10,20,21,22,30,40,50,60,70:(未知)

fs_top_set(payload: int | str | Iterable[int | str] | dict, /, top: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_top_set(payload: int | str | Iterable[int | str] | dict, /, top: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

文件或目录置顶

POST https://webapi.115.com/files/top

Payload:
  • file_id: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • top: 0 | 1 = 1

fs_video(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频信息和 m3u8 链接列表

GET https://webapi.115.com/files/video

Caution

local 在有些视频上不起作用,无论如何,都相当于 local=0,可能是因为文件超过 200 MB

但如果 local=1 有效,则返回仅可得到下载链接,key 为 “download_url”

Note

如果返回信息中有 “queue_url”,则可用于查询转码状态

如果视频从未被转码过,则会自动推送转码

Payload:
  • pickcode: str 💡 提取码

  • share_id: int | str = <default> 💡 共享 id

  • local: 0 | 1 = <default> 💡 是否本地,如果为 1,则不包括 m3u8

fs_video_add_caption_map(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_add_caption_map(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

关联字幕

POST https://webapi.115.com/movies/add_caption_map

Payload:
  • file_ids: int | str 💡 多个用逗号 “,” 隔开

  • type: int = 2

fs_video_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频信息和 m3u8 链接列表

POST https://proapi.115.com/{app}/2.0/video/play

Payload:
  • pickcode: str 💡 提取码

  • share_id: int | str = <default> 💡 共享 id

  • local: 0 | 1 = 0 💡 是否本地,如果为 1,则不包括 m3u8

  • user_id: int | str = <default> 💡 用户 id

fs_video_def_set(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_def_set(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

切换视频清晰度

POST https://webapi.115.com/files/video_def

Payload:
  • definition: str

fs_video_history(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取文件的观看历史,主要用于视频

GET https://webapi.115.com/files/history

Payload:
  • pick_code: str

  • fetch: str = “one”

  • category: int = 1 💡 类型:1:视频 3:音频

  • share_id: int | str = <default>

fs_video_history_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取历史记录

GET https://proapi.115.com/{app}/history

Payload:
  • pick_code: str

  • fetch: str = “one”

  • category: int = 1

  • share_id: int | str = <default>

fs_video_history_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

更新文件的观看历史,主要用于视频和音频

POST https://webapi.115.com/files/history

Payload:
  • pick_code: str 💡 文件的提取码

  • op: str = “update” 💡 操作类型,具体有哪些还需要再研究

  • category: int = 1 💡 类型:1:视频 3:音频

  • definition: int = <default> 💡 视频清晰度

  • share_id: int | str = <default>

  • time: int = <default> 💡 播放时间点(用来向服务器同步播放进度)

  • watch_end: int = <default> 💡 视频是否播放播放完毕 0:未完毕 1:完毕

  • …(其它未找全的参数)

fs_video_history_set_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

更新文件的观看历史,主要用于视频

POST https://proapi.115.com/{app}/history

Payload:
  • pick_code: str 💡 文件的提取码

  • op: str = “update” 💡 操作类型,具体有哪些还需要再研究

  • category: int = 1

  • definition: int = <default> 💡 视频清晰度

  • share_id: int | str = <default>

  • time: int = <default> 💡 播放时间点(用来向服务器同步播放进度)

  • watch_end: int = <default> 💡 视频是否播放播放完毕 0:未完毕 1:完毕

  • …(其它未找全的参数)

fs_video_is_transcode(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_is_transcode(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频的转码进度

POST https://webapi.115.com/files/is_transcoded

Payload:
  • pick_code: str

fs_video_m3u8(pickcode: str, definition: int = 0, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) bytes[source]
fs_video_m3u8(pickcode: str, definition: int = 0, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, bytes]

获取视频的 m3u8 文件列表,此接口必须使用 web 的 cookies

GET https://115.com/api/video/m3u8/{pickcode}.m3u8?definition={definition}

Attention

这个接口只支持 web 的 cookies,其它设备会返回空数据,而且获取得到的 m3u8 里的链接,也是 m3u8,会绑定前一次请求时的 user-agent

Parameters:
  • pickcode – 视频文件的 pickcode

  • definition – 画质,默认列出所有画质。但可进行筛选,常用的为: - 0: 各种分辨率(默认) - 1: SD 标清(约为 480p) - 3: HD 超清(约为 720p) - 4: UD 1080P(约为 1080p) - 5: BD 4K - 100: 原画(尺寸和原始的相同)

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口返回值

fs_video_multitrack_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_multitrack_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置视频音轨

POST https://webapi.115.com/movies/user_multitrack

Payload:
  • pick_code: str

  • track_id: str

  • user_id: int = <default>

fs_video_push(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_push(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

提交视频转码

POST https://115.com/?ct=play&ac=push

Payload:
  • pickcode: str

  • sha1: str = <default>

  • op: str = “vip_push” 💡 提交视频加速转码方式

    • “vip_push”: 根据;vip 等级加速

    • “pay_push”: 枫叶加速

fs_video_push_batch(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_push_batch(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

提交视频转码

POST https://115.com/?ctl=play&ac=batch_push

Payload:
  • file_ids: int | str 💡 多个用逗号 “,” 隔开

  • folder_ids: int | str 💡 多个用逗号 “,” 隔开

fs_video_push_batch2(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_push_batch2(payload: dict | int | str, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

提交视频转码

POST https://webapi.115.com/movies/batch_push

Payload:
  • file_ids: int | str 💡 多个用逗号 “,” 隔开

  • folder_ids: int | str 💡 多个用逗号 “,” 隔开

fs_video_subtitle(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_subtitle(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频字幕

GET https://webapi.115.com/movies/subtitle

Payload:
  • pickcode: str

fs_video_subtitle_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_subtitle_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频字幕

GET https://proapi.115.com/{app}/2.0/video/subtitle

Payload:
  • pickcode: str

fs_video_subtitle_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_subtitle_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置视频字幕

POST https://webapi.115.com/movies/user_subtitle

Payload:
  • pick_code: str

  • sid: str 💡 字幕的 id,通过 P115Client.fs_video_subtitle() 接口获得

  • action: str = “set” 💡 操作:”set”:设置 “delete”:删除

fs_video_transcode(payload: dict | str, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://transcode.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_transcode(payload: dict | str, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://transcode.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频的转码进度

GET https://transcode.115.com/api/1.0/{app}/1.0/trans_code/check_transcode_job

Payload:
  • sha1: str

  • priority: int = 100 💡 优先级

life_batch_delete(payload: Iterable[dict] | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_batch_delete(payload: Iterable[dict] | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量删除操作历史:批量删除 115 生活事件列表

POST https://life.115.com/api/1.0/{app}/1.0/life/life_batch_delete

Payload:
  • delete_data: str 💡 JSON array,每条数据格式为 {“relation_id”: str, “behavior_type”: str}

life_behavior_detail(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_behavior_detail(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 P115Client.life_list 操作记录明细

GET https://webapi.115.com/behavior/detail

Attention

这个接口最多能拉取前 10_000 条数据,且响应速度也较差,请优先使用 P115Client.life_behavior_detail_app()。 但如果指定 typedate,响应可能会快得多,但当涉及的总量较多时,速度依然会很慢,哪怕你只拉取其中的几条。

Caution

缺乏下面这些事件:

  • 从回收站还原文件或目录(但相应的删除事件会消失)

Payload:
  • type: str = “” 💡 操作类型,若不指定则是全部

    • “upload_image_file”: 1 💡 上传图片

    • “upload_file”: 2 💡 上传文件或目录(不包括图片)

    • “star_image”: 3 💡 给图片设置星标

    • “star_file”: 4 💡 给文件或目录设置星标(不包括图片)

    • “move_image_file”: 5 💡 移动图片

    • “move_file”: 6 💡 移动文件或目录(不包括图片)

    • “browse_image”: 7 💡 浏览图片

    • “browse_video”: 8 💡 浏览视频

    • “browse_audio”: 9 💡 浏览音频

    • “browse_document”: 10 💡 浏览文档

    • “receive_files”: 14 💡 接收文件

    • “new_folder”: 17 💡 新增目录

    • “copy_folder”: 18 💡 复制目录

    • “folder_label”: 19 💡 目录设置标签

    • “folder_rename”: 20 💡 目录改名

    • “delete_file”: 22 💡 删除文件或目录

    • “copy_file”: 23 💡 复制文件

    • “file_rename”: 24 💡 文件改名

  • limit: int = 1_000 💡 最大值为 1_000

  • offset: int = 0

  • date: str = <default> 💡 日期,格式为 ‘YYYY-MM-DD’,指定拉取这一天的数据

life_behavior_detail_app(payload: str | dict = '', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_behavior_detail_app(payload: str | dict = '', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 P115Client.life_list 操作记录明细

GET https://proapi.115.com/{app}/behavior/detail

Caution

缺乏下面这些事件:

  • 从回收站还原文件或目录(但相应的删除事件会消失)

Caution

此接口有被风控的风险,两次调用之间相隔 5 秒以上为宜,但即使风控,恢复起来也比较快

Payload:
  • type: str = “” 💡 操作类型

    • “upload_image_file”: 1 💡 上传图片

    • “upload_file”: 2 💡 上传文件或目录(不包括图片)

    • “star_image”: 3 💡 给图片设置星标

    • “star_file”: 4 💡 给文件或目录设置星标(不包括图片)

    • “move_image_file”: 5 💡 移动图片

    • “move_file”: 6 💡 移动文件或目录(不包括图片)

    • “browse_image”: 7 💡 浏览图片

    • “browse_video”: 8 💡 浏览视频

    • “browse_audio”: 9 💡 浏览音频

    • “browse_document”: 10 💡 浏览文档

    • “receive_files”: 14 💡 接收文件

    • “new_folder”: 17 💡 新增目录

    • “copy_folder”: 18 💡 复制目录

    • “folder_label”: 19 💡 目录设置标签

    • “folder_rename”: 20 💡 目录改名

    • “delete_file”: 22 💡 删除文件或目录

    • “copy_file”: 23 💡 复制文件

    • “file_rename”: 24 💡 文件改名

  • limit: int = 1_000 💡 最大值为 1_000

  • offset: int = 0

  • date: str = <default> 💡 日期,格式为 ‘YYYY-MM-DD’,指定拉取这一天的数据

life_behavior_doc_post_app(payload: int | str | Iterable[int | str] | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_behavior_doc_post_app(payload: int | str | Iterable[int | str] | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

推送事件:浏览文档 “browse_document”

POST https://proapi.115.com/{app}/files/doc_behavior

Payload:
  • file_id: int | str

  • file_id[0]: int | str

  • file_id[1]: int | str

life_behavior_img_post_app(payload: int | str | Iterable[int | str] | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_behavior_img_post_app(payload: int | str | Iterable[int | str] | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

推送事件:浏览图片 “browse_image”

POST https://proapi.115.com/{app}/files/img_behavior

Payload:
  • file_id: int | str

  • file_id[0]: int | str

  • file_id[1]: int | str

life_calendar_getoption(app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_calendar_getoption(app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 115 生活的开关设置

GET https://life.115.com/api/1.0/{app}/1.0/calendar/getoption

Hint

app 可以是任意字符串,服务器并不做检查。其他可用 app=”web” 的接口可能皆是如此

life_calendar_getoption2(app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_calendar_getoption2(app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 115 生活的开关设置

GET https://life.115.com/api/1.0/{app}/1.0/calendar/recent_operations_getoption

life_calendar_setoption(payload: Literal[0, 1] | dict = 1, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_calendar_setoption(payload: Literal[0, 1] | dict = 1, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置 115 生活的开关选项

POST https://life.115.com/api/1.0/{app}/1.0/calendar/setoption

Payload:
  • locus: 0 | 1 = 1 💡 开启或关闭最近记录

  • open_life: 0 | 1 = 1 💡 显示或关闭

  • birthday: 0 | 1 = <default>

  • holiday: 0 | 1 = <default>

  • lunar: 0 | 1 = <default>

  • view: 0 | 1 = <default>

  • diary: 0 | 1 = <default>

  • del_notice_item: 0 | 1 = <default>

  • first_week: 0 | 1 = <default>

life_calendar_setoption2(payload: Literal[0, 1] | dict = 1, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_calendar_setoption2(payload: Literal[0, 1] | dict = 1, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置 115 生活的开关选项

POST https://life.115.com/api/1.0/{app}/1.0/calendar/recent_operations_setoption

Payload:
  • locus: 0 | 1 = 1 💡 开启或关闭最近记录

  • open_life: 0 | 1 = 1 💡 显示或关闭

  • birthday: 0 | 1 = <default>

  • holiday: 0 | 1 = <default>

  • lunar: 0 | 1 = <default>

  • view: 0 | 1 = <default>

  • diary: 0 | 1 = <default>

  • del_notice_item: 0 | 1 = <default>

  • first_week: 0 | 1 = <default>

life_cdlist(payload: int | dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_cdlist(payload: int | dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取节假日等

GET https://life.115.com/api/1.0/{app}/1.0/life/cdlist

Payload:
  • start_time: int = <default> 💡 开始时间戳,单位是秒,默认为当年第一天零点

  • end_time: int = <default> 💡 开始时间戳,单位是秒,默认为次年第一天零点前一秒

  • holiday: 0 | 1 = <default> 💡 是否显示节假日

  • only_public: 0 | 1 = <default>

life_clear_history(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_clear_history(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

清空操作历史:清空 115 生活事件列表

POST https://life.115.com/api/1.0/{app}/1.0/life/life_clear_history

Payload:
  • tab_type: 0 | 1 = <default>

life_get_pic_url(payload: str | tuple[str, ...] | dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_get_pic_url(payload: str | tuple[str, ...] | dict | list, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量获取图片的预览图链接

POST https://life.115.com/api/1.0/{app}/1.0/imgload/get_pic_url

Hint

这个接口获取的链接似乎长久有效,而且支持任何文件(只要有人上传过),但限制文件大小在 50 MB 以内

Tip

在获得的链接最后加上一个 &i=1,就可以获取原始尺寸(但不一定是原图)

Payload:
  • rs: str 💡 图片的 sha1 (必须大写)或者 f”{oss_bucket}_{oss_object}”(由 upload_file_image 接口的响应获得),后者跳转次数更少、响应更快

  • rs[]: str

  • rs[0]: str

  • rs[1]: str

  • module: int = <default>

  • file_names[]: str = <default>

  • type[]: int = <default>

life_get_pic_url2(payload: str | tuple[str, ...] | dict | list, /, base_url: str | Callable[[], str] = 'https://q.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_get_pic_url2(payload: str | tuple[str, ...] | dict | list, /, base_url: str | Callable[[], str] = 'https://q.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量获取图片的预览图链接

POST https://q.115.com/ajax_request/get_pic_url

Hint

这个接口获取的链接似乎长久有效,而且支持任何文件(只要有人上传过),但限制文件大小在 50 MB 以内

Tip

在获得的链接最后加上一个 &i=1,就可以获取原始尺寸(但不一定是原图)

Payload:
  • rs: str 💡 图片的 sha1 (必须大写)或者 f”{oss_bucket}_{oss_object}”(由 upload_file_image 接口的响应获得),后者跳转次数更少、响应更快

  • rs[]: str

  • rs[0]: str

  • rs[1]: str

  • module: int = <default>

  • file_names[]: str = <default>

  • type[]: int = <default>

life_glist(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_glist(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取备忘(记录/笔记/记事)、日记或日程的列表

GET https://life.115.com/api/1.0/{app}/1.0/life/glist

Note

返回数据列表中,每一条都有个 “type” 字段,这个和请求参数里面的 “type” 含义并不同

  • 2: 备忘

  • 3: 日程

  • 4: 瞬间

  • 5: 日记

Payload:
  • start: int = 0 💡 开始索引,从 0 开始

  • limit: int = <default> 💡 分页大小

  • type: int = 8 💡 分类:1,6:瞬间 2:日记+日程 3:备忘 4,7:瞬间+备忘 5:日记 8:所有(日记+备忘+日程)

  • only_public: 0 | 1 = <default>

  • msg_note: 0 | 1 = <default>

  • option: 0 | 1 = <default>

life_has_data(payload: int | dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_has_data(payload: int | dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取有数据的那几天零点的时间戳

GET https://life.115.com/api/1.0/{app}/1.0/life/life_has_data

Payload:
  • end_time: int = <default>

  • show_note_cal: 0 | 1 = <default>

  • start_time: int = <default>

life_list(payload: int | str | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_list(payload: int | str | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列登录和增删改操作记录(最新几条)

GET https://life.115.com/api/1.0/{app}/1.0/life/life_list

Note

为了实现分页拉取,需要指定 last_data 参数。只要上次返回的数据不为空,就会有这个值,直接使用即可

Attention

此接口正在被 P115Client.life_recent_operations 取代

Hint

引用:https://cdnres.115.com/life/m_r/web/static_v11.0/homepage/lifetime.js

  • ‘upload_file’ => ‘上传文件’ 💡 上传文件(非图片) 文件类

  • ‘upload_image_file’ => ‘上传图片’ 💡 上传文件(图片) 文件类

  • ‘backup_album’ => ‘备份相册’ 💡 备份相册 文件类

  • ‘sync_communication’ => ‘同步通讯录’ 💡 同步通讯录 文件类

  • ‘receive_files’ => ‘接收文件’ 💡 接收文件 文件类

  • ‘star_file’ => ‘星标文件’ 💡 星标文件 文件类

  • ‘radar_sharing’ => ‘雷达分享’ 💡 雷达分享 文件类

  • ‘file_search’ => ‘文件搜索’ 💡 文件搜索 文件类

  • ‘move_file’ => ‘移动文件’ 💡 移动文件(非图片) 文件类

  • ‘move_image_file’ => ‘移动图片’ 💡 移动文件(图片) 文件类

  • ‘browse_document’ => ‘浏览文档’ 💡 浏览文档 信息预览类

  • ‘browse_video’ => ‘浏览视频’ 💡 浏览视频 信息预览类

  • ‘browse_audio’ => ‘浏览音频’ 💡 浏览音频 信息预览类

  • ‘browse_image’ => ‘浏览图片’ 💡 浏览图片 信息预览类

  • ‘publish_record’ => ‘发布记录’ 💡 发布记录 信息发布类

  • ‘publish_calendar’ => ‘发布日程’ 💡 发布日程 信息发布类

  • ‘publish_home’ => ‘发布传说’ 💡 发布传说 信息发布类

  • ‘account_security’ => ‘账号安全’ 💡 账号安全 账号安全类

一些筛选条件:

- 全部:type=0
- 上传文件:type=1&file_behavior_type=1
- 浏览文件:type=1&file_behavior_type=2
- 星标文件:type=1&file_behavior_type=3
- 移动文件:type=1&file_behavior_type=4
- 目录:type=1&file_behavior_type=5
- 备份:type=1&file_behavior_type=6
- 删除文件:type=1&file_behavior_type=7
- 账号安全:type=2
- 通讯录:type=3
- 其他:type=99

一些类型分类:

.. code:: python

    {
        'file':['upload_file', 'upload_image_file', 'backup_album', 'sync_communication',
                'receive_files', 'star_file', 'radar_sharing', 'file_search', 'move_file',
                'move_image_file', 'star_image', 'del_photo_image', 'del_similar_image',
                'generate_smart_albums', 'new_person_albums', 'del_person_albums',
                'generate_photo_story', 'share_photo', 'folder_rename', 'folder_label',
                'new_folder', 'copy_folder', 'delete_file'],
        'review':['browse_video', 'browse_document', 'browse_audio', 'browse_image'],
        'edit':['publish_record', 'publish_calendar', 'publish_home'],
        'safe':['account_security'],
        'cloud':[],
        'share': ['share_contact']
    }
Payload:
  • start: int = 0

  • limit: int = 1_000

  • check_num: int = <default> 💡 选中记录数

  • del_data: str = <default> 💡 JSON array,删除时传给接口数据

  • end_time: int = <default> 💡 结束时间戳

  • file_behavior_type: int | str = <default> 💡 筛选类型,有多个则用逗号 ‘,’ 隔开

    • 💡 0: 所有

    • 💡 1: 上传

    • 💡 2: 浏览

    • 💡 3: 星标

    • 💡 4: 移动

    • 💡 5: 标签

    • 💡 6: <UNKNOWN>

    • 💡 7: 删除

  • isPullData: ‘true’ | ‘false’ = <default> 💡 是否下拉加载数据

  • isShow: 0 | 1 = <default> 💡 是否显示

  • last_data: str = <default> 💡 JSON object, e.g. ‘{“last_time”:1700000000,”last_count”:1,”total_count”:200}’

  • mode: str = <default> 💡 操作模式

    • 💡 “show” 展示列表模式

    • 💡 “select”: 批量操作模式

  • selectedRecords: str = <default> 💡 JSON array,选中记录 id 数组

  • show_note_cal: 0 | 1 = <default>

  • show_type: int = 0 💡 筛选类型,有多个则用逗号 ‘,’ 隔开

    • 💡 0: 所有

    • 💡 1: 增、删、改、移动、上传、接收、设置标签等文件系统操作

    • 💡 2: 浏览文件

    • 💡 3: <UNKNOWN>

    • 💡 4: account_security

  • start_time: int = <default> 💡 开始时间戳

  • tab_type: int = <default>

  • total_count: int = <default> 💡 列表所有项数

  • type: int = <default> 💡 类型

life_recent_browse(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_recent_browse(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近浏览记录

GET https://life.115.com/api/1.0/{app}/1.0/life/recent_browse

Payload:
  • start: int = 0

  • limit: int = 1000

life_recent_operation_items(payload: str | dict = 'browse_document', /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_recent_operation_items(payload: str | dict = 'browse_document', /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近操作记录详细

GET https://life.115.com/api/1.0/{app}/1.0/life/recent_operation_items

Caution

这个接口目前必须传 behavior_typedate,而且支持的 behavior_type 仅限浏览、移动、复制、重命名

Caution

谨慎,此接口明显是半成品,几乎和 P115Client.life_behavior_detail 一样慢,但能力却似乎远远不如

Payload:
  • behavior_type: str 💡 操作类型(尾部带🚫的表示暂不可用)

    • “upload_image_file”: 1 💡 上传图片🚫

    • “upload_file”: 2 💡 上传文件或目录(不包括图片)🚫

    • “star_image”: 3 💡 给图片设置星标🚫

    • “star_file”: 4 💡 给文件或目录设置星标(不包括图片)🚫

    • “move_image_file”: 5 💡 移动图片

    • “move_file”: 6 💡 移动文件或目录(不包括图片)

    • “browse_image”: 7 💡 浏览图片

    • “browse_video”: 8 💡 浏览视频

    • “browse_audio”: 9 💡 浏览音频

    • “browse_document”: 10 💡 浏览文档

    • “receive_files”: 14 💡 接收文件🚫

    • “new_folder”: 17 💡 新增目录🚫

    • “copy_folder”: 18 💡 复制目录

    • “folder_label”: 19 💡 目录设置标签🚫

    • “folder_rename”: 20 💡 目录改名

    • “delete_file”: 22 💡 删除文件或目录🚫

    • “copy_file”: 23 💡 复制文件

    • “file_rename”: 24 💡 文件改名

  • date: str 💡 日期,格式为 ‘YYYY-MM-DD’,指定拉取这一天的数据

  • start: int = 0

  • limit: int = 100 💡 最大值为 100

life_recent_operations(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_recent_operations(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近操作记录

GET https://life.115.com/api/1.0/{app}/1.0/life/recent_operations

Payload:
  • start: int = 0

  • limit: int = 1_000

  • start_time: int = <default>

  • end_time: int = <default>

  • last_data: str = <default> 💡 需要经过 JSON序列化,格式为:{“last_time”: int, “last_count”: int, “total_count”: int}

  • operation_type: 0 | 1 | 2 | 3 = 0 💡 操作类型

    • 0: 全部

    • 1: 浏览

    • 2: 移动复制

    • 3: 重命名

life_recent_operations_clear(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_recent_operations_clear(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

清空最近操作记录

GET https://life.115.com/api/1.0/{app}/1.0/life/recent_operations_clear

Payload:
  • tab_type: int = 0

life_recent_operations_del(payload: Iterable[dict] | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_recent_operations_del(payload: Iterable[dict] | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量删除最近操作记录

GET https://life.115.com/api/1.0/{app}/1.0/life/recent_operations_del

Payload:
  • delete_data: str 💡 JSON array,每条数据格式为 {“relation_id”: str, “behavior_type”: str}

life_set_top(payload: dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
life_set_top(payload: dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://life.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

切换备忘(记录/笔记/记事)、日记或日程的置顶状态

GET https://life.115.com/api/1.0/{app}/1.0/life/set_top

Attention

这个接口会自动切换记录的置顶状态,但不支持手动指定是否置顶,只是在置顶和不置顶间来回切换。

Payload:
  • relation_id: int | str 💡 备忘、日程或日记的 id

  • type: int 💡 分类:2:备忘 3:日程 4:瞬间 5:日记

login(app: None | str = None, console_qrcode: bool = True, *, async_: Literal[False] = False, **request_kwargs) Self[source]
login(app: None | str = None, console_qrcode: bool = True, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, Self]

扫码二维码登录,如果已登录则忽略

Parameters:
  • app – 扫二维码后绑定的 app (或者叫 device),如果不指定,则根据 cookies 的 UID 字段来确定,如果不能确定,则用 “qandroid”

  • console_qrcode – 在命令行输出二维码,否则在浏览器中打开

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

返回对象本身


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

login_another_app(app: None | str = None, replace: bool | Self = False, show_warning: bool = False, *, async_: Literal[False] = False, **request_kwargs) Self[source]
login_another_app(app: None | str = None, replace: bool | Self = False, show_warning: bool = False, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, Self]

登录某个设备(同一个设备可以有多个同时在线,但可以通过某些操作,把除了最近登录的那个都下线,也可以专门把最近登录那个也下线)

Hint

一个设备被新登录者下线,意味着这个 cookies 失效了,不能执行任何需要权限的操作

但一个设备的新登录者,并不总是意味着把较早的登录者下线,一般需要触发某个检查机制后,才会把同一设备下除最近一次登录外的所有 cookies 失效

所以你可以用一个设备的 cookies 专门用于扫码登录,获取另一个设备的 cookies 执行网盘操作,第 2 个 cookies 失效了,则用第 1 个 cookies 扫码,如此可避免单个 cookies 失效后,不能自动获取新的

Parameters:
  • app – 要登录的 app,如果为 None,则用当前登录设备,如果无当前登录设备,则报错

  • replace

    替换某个 P115Client 对象的 cookie

    • 如果为 P115Client, 则更新到此对象

    • 如果为 True,则更新到 self

    • 如果为 False,否则返回新的 P115Client 对象

  • show_warning – 是否显示提示信息

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

客户端实例


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

login_another_open(app_id: int = 0, replace: bool | P115OpenClient = False, show_warning: bool = False, *, async_: Literal[False] = False, **request_kwargs) P115OpenClient[source]
login_another_open(app_id: int = 0, replace: bool | P115OpenClient = False, show_warning: bool = False, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115OpenClient]

登录某个开放接口应用

Note

同一个开放应用 id,最多同时有 3 个登入,如果有新的登录,则自动踢掉较早的那一个

Parameters:
  • app_id – AppID

  • replace

    替换某个 client 对象的 access_tokenrefresh_token

    • 如果为 P115Client, 则更新到此对象

    • 如果为 True,则更新到 self

    • 如果为 False,否则返回新的 P115Client 对象

  • show_warning – 是否显示提示信息

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

客户端实例

login_app(async_: Literal[False] = False, **request_kwargs) None | str[source]
login_app(async_: Literal[True], **request_kwargs) Coroutine[Any, Any, None | str]

获取当前的登录设备名,如果为 None,说明未能获得

classmethod login_bind_app(uid: str, app: str = 'alipaymini', *, async_: Literal[False] = False, **request_kwargs) Self[source]
classmethod login_bind_app(uid: str, app: str = 'alipaymini', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, Self]

获取绑定到某个设备的 cookies

Hint

同一个设备可以有多个 cookies 同时在线

其实只要你不主动去执行检查,这些 cookies 可以同时生效,只是看起来像“黑户”

Parameters:
  • uid – 登录二维码的 uid

  • app – 待绑定的设备名称

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

新的实例


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

login_check_sso(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_check_sso(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检查当前 cookies 的登录状态信息,并且自最近一次登录的 60 秒后,使当前设备下除最近一次登录外的所有 cookies 失效

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/check/sso

login_device(async_: Literal[False] = False, **request_kwargs) None | dict[source]
login_device(async_: Literal[True], **request_kwargs) Coroutine[Any, Any, None | dict]

获取当前的登录设备的信息,如果为 None,也不代表当前的 cookies 被下线,只能说明有更晚的登录到同一设备

login_devices(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_devices(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取所有的已登录设备的信息,不过当前的 cookies 必须是登录状态(未退出或未失效)

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/login_log/login_devices

login_info(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_info(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取登录信息

GET https://proapi.115.com/{app}/2.0/login_info

login_info_open(app_id: int = 0, *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_info_open(app_id: int = 0, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取某个开放接口应用的信息(目前可获得名称和头像)

Parameters:
  • app_id – AppID

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口返回值

login_log(payload: dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_log(payload: dict = {}, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取登录信息日志列表

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/login_log/log

Payload:
  • start: int = 0

  • limit: int = 100

login_online(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_online(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

当前登录的设备总数和最近登录的设备

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/login_log/login_online

login_open_auth_detail(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_open_auth_detail(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取某个开放应用的授权信息

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/user/getAppAuthDetail

Payload:
  • auth_id: int | str 💡 授权 id

login_open_auth_list(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_open_auth_list(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取所有授权的开放应用的列表

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/user/getAppAuthList

login_open_deauth(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_open_deauth(payload: int | str | dict, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

取消某个开放应用的授权

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/user/deauthApp

Payload:
  • auth_id: int | str 💡 授权 id

property login_ssoent: str

获取当前的登录设备 ssoent,如果为空,说明未能获得(会直接获取 Cookies 中名为 UID 字段的值,所以即使能获取,也不能说明登录未失效)

login_status(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) bool[source]
login_status(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, bool]

检查是否已登录

GET https://my.115.com/?ct=guide&ac=status

login_with_app(app: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
login_with_app(app: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

执行一次自动扫登录二维码,然后绑定到指定设备

Parameters:
  • app – 绑定的 app (或者叫 device),如果为 None 或 “”,则和当前 client 的登录设备相同

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

响应信息,包含 cookies


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

login_with_open(app_id: int = 0, *, show_warning: bool = False, async_: Literal[False] = False, **request_kwargs) dict[source]
login_with_open(app_id: int = 0, *, show_warning: bool = False, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

登录某个开放接口应用

Note

同一个开放应用 id,最多同时有 3 个登入,如果有新的登录,则自动踢掉较早的那一个

Parameters:
  • app_id – AppID

  • show_warning – 是否显示提示信息

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口返回值

login_without_app(show_warning: bool = False, *, async_: Literal[False] = False, **request_kwargs) str[source]
login_without_app(show_warning: bool = False, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, str]

执行一次自动扫登录二维码,但不绑定设备,返回扫码的 uid,可用于之后绑定设备

Parameters:
  • show_warning – 是否显示提示信息

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

二维码的 uid

logout(app: None | str = 'android', method: str = 'POST', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) None[source]
logout(app: None | str = 'android', method: str = 'POST', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, None]

当前设备退出登录状态

POST https://qrcodeapi.115.com/app/1.0/{app}/1.0/logout/index

Tip

无论指定什么 app,都是退出当前 cookies 所对应的登录设备

logout_by_app(app: None | str = None, base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) None[source]
logout_by_app(app: None | str = None, base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, None]

退出登录状态(可以把某个客户端下线,所有已登录设备可从 login_devices 获取)

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/logout/logout

Parameters:

app – 退出登录的 app


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

logout_by_ssoent(payload: None | str | dict = None, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
logout_by_ssoent(payload: None | str | dict = None, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

退出登录状态(可以把某个客户端下线,所有已登录设备可从 login_devices 获取)

POST https://qrcodeapi.115.com/app/1.0/{app}/1.0/logout/mange

Payload:
  • ssoent: str


设备列表如下:

No.

ssoent

app

description

01

A1

web

115生活_网页端

A1

desktop

115浏览器

A2

?

未知: android

A3

?

未知: ios

A4

?

未知: ipad

B1

?

未知: android

02

D1

ios

115生活_苹果端

03

D2

bios

未知: ios

04

D3

115ios

115_苹果端

05

F1

android

115生活_安卓端

06

F2

bandroid

未知: android

07

F3

115android

115_安卓端

08

H1

ipad

115生活_苹果平板端

09

H2

bipad

未知: ipad

10

H3

115ipad

115_苹果平板端

11

I1

tv

115生活_安卓电视端

12

I2

apple_tv

115生活_苹果电视端

13

M1

qandriod

115管理_安卓端

14

N1

qios

115管理_苹果端

15

O1

qipad

115管理_苹果平板端

16

P1

os_windows

115生活_Windows端

17

P2

os_mac

115生活_macOS端

18

P3

os_linux

115生活_Linux端

19

R1

wechatmini

115生活_微信小程序端

20

R2

alipaymini

115生活_支付宝小程序

21

S1

harmony

115_鸿蒙端

msg_contacts_ls(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://pmsg.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
msg_contacts_ls(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://pmsg.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取提示消息

GET https://pmsg.115.com/api/1.0/app/1.0/contact/ls

Payload:
  • limit: int = 115

  • skip: int = 0

  • t: 0 | 1 = 1

msg_contacts_notice(base_url: str | Callable[[], str] = 'https://msg.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
msg_contacts_notice(base_url: str | Callable[[], str] = 'https://msg.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取提示消息

GET https://msg.115.com/?ct=contacts&ac=notice&client=web

msg_get_websocket_host(base_url: str | Callable[[], str] = 'https://msg.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
msg_get_websocket_host(base_url: str | Callable[[], str] = 'https://msg.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 websocket 链接

GET https://msg.115.com/?ct=im&ac=get_websocket_host

Note

用返回数据构造链接,可由此监听 websocket 消息,但目前来看,最多也就实时获得一个【删除】事件

wss://{server}/?uid={user_id}&session={session_id}&client_version=100&client_type=5&sequence_id=0&source=web&device_id=0000000000000000000000000000000000000000

multimedia_collection_listen(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_collection_listen(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:自建听单(合集)列表

GET https://webapi.115.com/multimedia/collection_listen

Todo

暂不清楚 sort 字段各个取值的含义

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • limit: int = 32

  • offset: int = 0

  • sort: int = <default> 💡 排序依据

  • asc: 0 | 1 = <default> 💡 是否升序排列

multimedia_collection_listen_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_collection_listen_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:设置听单(合集)

POST https://webapi.115.com/multimedia/collection_listen

Payload:
  • multimedia_id: int 💡 专辑(详情) id

  • channel_id: int = <default> 💡 频道 id,已知:1:音乐 5:视频

  • collection: 0 | 1 = 1 💡 是否设为合集:0:取消 1:设置(设为合集后,该内容将出现在【自建听单】列表中)

multimedia_collection_watch(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_collection_watch(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我看:自建合集列表

GET https://webapi.115.com/multimedia/collection_watch

Todo

暂不清楚 sort 字段各个取值的含义

Payload:
  • channel_id: int = 5 💡 频道 id,已知:1:音乐 5:视频

  • limit: int = 32

  • offset: int = 0

  • sort: int = <default> 💡 排序依据

  • asc: 0 | 1 = <default> 💡 是否升序排列

multimedia_collection_watch_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_collection_watch_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我看:设置合集

POST https://webapi.115.com/multimedia/collection_watch

Payload:
  • multimedia_id: int 💡 专辑(详情) id

  • channel_id: int = 5 💡 频道 id,已知:1:音乐 5:视频

  • collection: 0 | 1 = 1 💡 是否设为合集:0:取消 1:设置(设为合集后,该内容将出现在自建合集列表中)

multimedia_cover_auto(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_cover_auto(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:自动生成(专辑)封面

POST https://webapi.115.com/multimedia/cover

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • ids: int | str 💡 专辑 id,多个用逗号 “,” 隔开

  • overwrite: 0 | 1 = 0 💡 是否覆盖

multimedia_cover_check(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_cover_check(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:查看(专辑)封面是否存在

GET https://webapi.115.com/multimedia/cover_check

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • ids: int | str 💡 专辑 id,多个用逗号 “,” 隔开

multimedia_listen(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_listen(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:专辑(详情)列表 或 专辑(详情)的基本信息和文件列表

GET https://webapi.115.com/multimedia/listen

Note

  • 指定 multimedia_id,则罗列此专辑(详情)的基本信息和文件列表

  • 指定 parent_id,则罗列关联此 id 的专辑(详情)列表

  • 都不指定,则罗列所有专辑(详情)列表

Todo

暂不清楚 sort 字段各个取值的含义

Todo

暂不清楚 date 字段的格式要求

Todo

应该还可以选择【维度】和【时间区间】,但是目前 115 的网页版还未完成此功能

Note

一个 multimedia_id 对应的专辑被称为详情,如果它还关联到其它 multimedia_id,也就是它们的 parent_id,或者被主动【设为合集】,称为合集

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • parent_id: int = <default> 💡 关联的专辑(详情) id

  • multimedia_id: int = <default> 💡 专辑(详情) id

  • limit: int = <default> 💡 最多返回数量

  • offset: int = <default> 💡 索引偏移,索引从 0 开始计算

  • sort: int = <default> 💡 排序依据

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • visit_type: int = <default> 💡 已知:0:全部 1:已听 2:未听

  • type_id: int = <default> 💡 分类 id

  • related_name: str = <default> 💡 相关人员名称

  • collection: 0 | 1 = <default> 💡 内容类型:<default>:全部 0:属性 1:合集

  • date: str = <default> 💡 日期、月份或者年份

multimedia_listen_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_listen_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:更新专辑(详情)

POST https://webapi.115.com/multimedia/listen

Payload:
  • multimedia_id: int 💡 专辑(详情) id

  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • parent_id: int = <default> 💡 关联的专辑(详情) id(作为当前专辑(详情)的上级)

  • custom_sort: int = <default> 💡 自定义排序

  • title: str = <default> 💡 标题

  • description: str = <default> 💡 简介

  • cover: str = <default> 💡 封面图片的提取码

  • country: str = <default> 💡 国家/地区

  • language: str = <default> 💡 语言,多个用逗号 “,” 隔开

  • release_date: str = <default> 💡 发行日期,格式为 YYYY-MM-DD

  • type_id: int | str = <default> 💡 类型 id

  • type_id[]: int | str

  • type_id[0]: int | str

  • type_id[1]: int | str

  • related_id[][{related_id}]: str 💡 相关人员,是 id 到 名字 的映射关系

  • rating[1]: int | float | str = <default> 💡 评分:豆瓣

  • rating[2]: int | float | str = <default> 💡 评分:猫眼

  • rating[3]: int | float | str = <default> 💡 评分:烂番茄

  • rating[4]: int | float | str = <default> 💡 评分:优酷

  • rating[5]: int | float | str = <default> 💡 评分:115

  • rating[6]: int | float | str = <default> 💡 评分:IMDB

  • extra_info: str = <default> 💡 附加信息,是一个 JSON object 序列化为字符串,初始值为 ‘{“version”:””,”timbre”:””,”track”:””,”scene”:””}’

  • is_delete: 0 | 1 = <default> 💡 是否删除

multimedia_recent_listen(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_recent_listen(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:【最近在听】列表

GET https://webapi.115.com/multimedia/recent_listen

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • limit: int = 32

  • offset: int = 0

multimedia_recent_listen_update(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_recent_listen_update(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:更新【最近在听】

POST https://webapi.115.com/multimedia/recent_listen

Note

目前仅支持 clear 操作,即 清空所有记录

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • action: str = “clear”

multimedia_recent_watch(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_recent_watch(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我看:【最近观看】列表

GET https://webapi.115.com/multimedia/recent_watch

Payload:
  • channel_id: int = 5 💡 频道 id,已知:1:音乐 5:视频

  • limit: int = 32

  • offset: int = 0

multimedia_recent_watch_update(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_recent_watch_update(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听:更新【最近观看】

POST https://webapi.115.com/multimedia/recent_watch

Note

目前仅支持 clear 操作,即 清空所有记录

Payload:
  • channel_id: int = 5 💡 频道 id,已知:1:音乐 5:视频

  • action: str = “clear”

multimedia_relate_file(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_relate_file(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:罗列专辑(详情)的关联文件

GET https://webapi.115.com/multimedia/relate_file

Payload:
  • multimedia_id: int 💡 专辑(详情) id

  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • limit: int = 32

  • offset: int = 0

  • o: “custom_sort” | “file_name” | “file_size” | “created_time” = <default> 💡 排序依据

  • asc: 0 | 1 = <default> 💡 是否升序排列

multimedia_relate_file_update(payload: int | str | Iterable[int | str] | dict, /, channel_id: int | str = 1, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_relate_file_update(payload: int | str | Iterable[int | str] | dict, /, channel_id: int | str = 1, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:更新专辑(详情)的关联文件

POST https://webapi.115.com/multimedia/relate_file

Note

指定 multimedia_id 时,则针对相应的专辑(详情)进行文件增删;未指定时,则自动创建新的专辑(详情)

Payload:
  • file_ids: int | str 💡 文件或目录 id,多个用逗号 “,” 隔开

  • op: str = “relate” 💡 已知:”relate”:添加 “delete”:删除 “update”:更新

  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • multimedia_id: int = <default> 💡 专辑(详情) id

  • one_by_one: 0 | 1 = <default> 💡 (未指定 multimedia_id 时生效)是否分别创建专辑(详情):0:为所选文件创建为一个详情页 1:为每个文件创建单独的详情页

  • sort: int = <default> 💡 序号,用来作为自定义排序的依据

  • visited: 0 | 1 | 2 = <default> 💡 是否标记为访问过

multimedia_related(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:人员列表

GET https://webapi.115.com/multimedia/related

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

multimedia_related_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:更新人员

GET https://webapi.115.com/multimedia/related

Note

未指定 related_id 时,则是添加(此时需要指定 related_name);指定时,则是修改

Todo

暂不支持删除人员

Payload:
  • related_name: str 💡 相关人员名字

  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • related_id: int = <default> 💡 相关人员 id

multimedia_relation(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_relation(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:罗列专辑(详情)的关联

POST https://webapi.115.com/multimedia/relation

Payload:
  • multimedia_id: int 💡 专辑(详情) id

  • parent_id: int

  • op: str

multimedia_type(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_type(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:分类列表

GET https://webapi.115.com/multimedia/type

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • parent_id: int = <default>

multimedia_type_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_type_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我听&我看:更新分类

GET https://webapi.115.com/multimedia/type

Note

目前支持创建最多 3 级分类,parent_id=0 时为 1 级分类

Note

未指定 type_id 时,则是添加(此时需要指定 type_name);指定时,则是修改

Todo

暂不支持删除分类

Payload:
  • channel_id: int = 1 💡 频道 id,已知:1:音乐 5:视频

  • parent_id: int = <default> 💡 上级分类 id

  • type_id: int = <default> 💡 分类 id

  • type_name: str = <default> 💡 分类名称

  • sort: int = <default> 💡 序号

multimedia_watch(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_watch(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我看:专辑(详情)列表 或 专辑(详情)的基本信息和文件列表

GET https://webapi.115.com/multimedia/watch

Note

  • 指定 multimedia_id,则罗列此专辑(详情)的基本信息和文件列表

  • 指定 parent_id,则罗列关联此 id 的专辑(详情)列表

  • 都不指定,则罗列所有专辑(详情)列表

Todo

暂不清楚 sort 字段各个取值的含义

Todo

暂不清楚 date 字段的格式要求

Todo

应该还可以选择【维度】和【时间区间】,但是目前 115 的网页版还未完成此功能

Note

一个 multimedia_id 对应的专辑被称为详情,如果它还关联到其它 multimedia_id,也就是它们的 parent_id,或者被主动【设为合集】,称为合集

Payload:
  • channel_id: int = 5 💡 频道 id,已知:1:音乐 5:视频

  • parent_id: int = <default> 💡 关联的专辑(详情) id

  • multimedia_id: int = <default> 💡 专辑(详情) id

  • limit: int = <default> 💡 最多返回数量

  • offset: int = <default> 💡 索引偏移,索引从 0 开始计算

  • sort: int = <default> 💡 排序依据

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • visit_type: int = <default> 💡 已知:0:全部 1:已看 2:未看

  • type_id: int = <default> 💡 分类 id

  • related_name: str = <default> 💡 相关人员名称

  • collection: 0 | 1 = <default> 💡 内容类型:<default>:全部 0:详情 1:合集

  • date: str = <default> 💡 日期、月份或者年份

  • keyword: str = <default> 💡 搜索关键词

multimedia_watch_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
multimedia_watch_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

我看:更新专辑(详情)

POST https://webapi.115.com/multimedia/watch

Payload:
  • multimedia_id: int 💡 专辑(详情) id

  • channel_id: int = 5 💡 频道 id,已知:1:音乐 5:视频

  • parent_id: int = <default> 💡 关联的专辑(详情) id(作为当前专辑(详情)的上级)

  • custom_sort: int = <default> 💡 自定义排序

  • title: str = <default> 💡 标题

  • description: str = <default> 💡 简介

  • cover: str = <default> 💡 封面图片的提取码

  • country: str = <default> 💡 国家/地区

  • language: str = <default> 💡 语言,多个用逗号 “,” 隔开

  • release_date: str = <default> 💡 发行日期,格式为 YYYY-MM-DD

  • type_id: int | str = <default> 💡 类型 id

  • type_id[]: int | str

  • type_id[0]: int | str

  • type_id[1]: int | str

  • related_id[][{related_id}]: str 💡 相关人员,是 id 到 名字 的映射关系

  • rating[1]: int | float | str = <default> 💡 评分:豆瓣

  • rating[2]: int | float | str = <default> 💡 评分:猫眼

  • rating[3]: int | float | str = <default> 💡 评分:烂番茄

  • rating[4]: int | float | str = <default> 💡 评分:优酷

  • rating[5]: int | float | str = <default> 💡 评分:115

  • rating[6]: int | float | str = <default> 💡 评分:IMDB

  • extra_info: str = <default> 💡 附加信息,是一个 JSON object 序列化为字符串,初始值为 ‘{“version”:””,”timbre”:””,”track”:””,”scene”:””}’

  • is_delete: 0 | 1 = <default> 💡 是否删除

note_bookmark_list(payload: int | str | dict = '', /, base_url: str | Callable[[], str] = 'https://bookmark.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_bookmark_list(payload: int | str | dict = '', /, base_url: str | Callable[[], str] = 'https://bookmark.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列书签(网址收藏夹)

GET https://bookmark.115.com/api/bookmark_list.php

Note

这个接口支持 GET 和 POST 请求方法

Payload:
  • search_value: str = “”

  • parent_id: int = 0

  • limit: int = 1150

  • offset: int = 0

note_cate_add(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_cate_add(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加记录分类

POST https://note.115.com/?ct=note&ac=addcate

Payload:
  • cname: str 💡 最多允许 20 个字符

note_cate_del(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_cate_del(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除记录分类

POST https://note.115.com/?ct=note&ac=delcate

Payload:
  • cid: int 💡 分类 id

  • action: str = <default>

note_cate_list(payload: bool | dict = True, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_cate_list(payload: bool | dict = True, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取记录分类列表

GET https://note.115.com/?ct=note&ac=cate

Payload:
  • has_picknews: 0 | 1 = 1 💡 是否显示 id 为负数的分类

note_cate_list2(payload: bool | dict = True, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_cate_list2(payload: bool | dict = True, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取记录分类列表

GET https://note.115.com/api/2.0/api.php?ac=get_category

Payload:
  • has_picknews: 0 | 1 = 1 💡 是否显示 id 为负数的分类

  • is_all: 0 | 1 = <default> 💡 是否显示全部

  • has_msg: 0 | 1 = <default>

note_cate_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_cate_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

改名记录分类

POST https://note.115.com/?ct=note&ac=upcate

Payload:
  • cid: int 💡 分类 id

  • cname: str 💡 分类名,最多 20 个字符

note_del(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_del(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除记录

POST https://note.115.com/?ct=note&ac=delete

Payload:
  • nid: int | str 💡 记录 id,多个用逗号 “,” 隔开

note_del2(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_del2(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除记录

POST https://note.115.com/api/2.0/api.php?ac=note_delete

Payload:
  • nid: int | str 💡 记录 id,多个用逗号 “,” 隔开

note_detail(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_detail(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取备忘(记录/笔记/记事)数据

GET https://note.115.com/?ct=note&ac=detail

Payload:
  • nid: int 💡 记录 id

note_detail2(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_detail2(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取备忘(记录/笔记/记事)数据

GET https://note.115.com/api/2.0/api.php?ac=note_detail

Payload:
  • nid: int 💡 记录 id

  • has_picknews: 0 | 1 = <default>

  • is_html: 0 | 1 = <default>

  • copy: 0 | 1 = <default>

note_edit_attaches(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_edit_attaches(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

给记录修改附件

POST https://note.115.com/?ct=note&ac=edit_attaches

Attention

每个附件的大小必须控制在 200 MB 以内,这也是网页版所允许的单次下载的最大文件

Payload:
  • nid: int 💡 记录 id

  • pickcodes: str 💡 附件的提取码,多个用逗号 “,” 隔开

  • op: “add” | “del” | “save” = “add” 💡 操作类型:”add”:添加 “del”:去除 “save”:置换

note_fav_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_fav_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取星标备忘(记录/笔记/记事)列表

GET https://note.115.com/?ct=note&ac=get_fav_note_list

Payload:
  • start: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 最多返回数量

note_fav_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_fav_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

给记录添加或去除星标

POST https://note.115.com/?ct=note&ac=fav

Payload:
  • note_id: int 💡 记录 id

  • op: “add” | “del” = “add” 💡 操作类型:”add”:添加 “del”:去除

note_get_pic_url(payload: str | tuple[str, ...] | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_get_pic_url(payload: str | tuple[str, ...] | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量获取图片的预览图链接

POST https://note.115.com?ct=note&ac=get_pic_url

Hint

这个接口获取的链接似乎长久有效,而且支持任何文件(只要有人上传过),但限制文件大小在 50 MB 以内

Payload:
  • rs: str 💡 图片的 sha1 (必须大写)或者 f”{oss_bucket}_{oss_object}”(由 upload_file_image 接口的响应获得),后者跳转次数更少、响应更快

  • rs[]: str

  • rs[0]: str

  • rs[1]: str

  • module: int = <default>

  • file_names[]: str = <default>

  • type[]: int = <default>

note_get_pic_url2(payload: str | tuple[str, ...] | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_get_pic_url2(payload: str | tuple[str, ...] | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量获取图片的预览图链接

POST https://note.115.com/api/2.0/api.php?ac=get_pic_url

Hint

这个接口获取的链接似乎长久有效,而且支持任何文件(只要有人上传过),但限制文件大小在 50 MB 以内

Payload:
  • rs: str 💡 图片的 sha1 (必须大写)或者 f”{oss_bucket}_{oss_object}”(由 upload_file_image 接口的响应获得),后者跳转次数更少、响应更快

  • rs[]: str

  • rs[0]: str

  • rs[1]: str

  • module: int = <default>

  • file_names[]: str = <default>

  • type[]: int = <default>

note_is_fav(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_is_fav(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检查记录是否被星标

Note

这个接口支持 GET 和 POST 请求方法

GET https://note.115.com/api/2.0/api.php?ac=is_fav

Payload:
  • note_id: int | str 💡 多个用逗号 “,” 隔开

note_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取备忘(记录/笔记/记事)列表

GET https://note.115.com/?ct=note

Payload:
  • ac: “” | “all” = “all” 💡 如果为 “all”,则显示完整信息,如果为 “”,则显示简要信息(只有标题,没有内容文本)

  • start: int = 0 💡 开始索引,从 0 开始

  • page_size: int = 1150 💡 分页大小,相当于 limit

  • cid: int = 0 💡 分类 id:0:全部 -10:云收藏 -15:消息备忘

  • has_picknews: 0 | 1 = 1 💡 是否显示 id 为负数的分类

  • keyword: str = <default>

  • recently: 0 | 1 = <default> 💡 是否为最近

note_list2(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_list2(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取备忘(记录/笔记/记事)列表

GET https://note.115.com/api/2.0/api.php?ac=note_list

Payload:
  • start: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 分页大小

  • cid: int = 0 💡 分类 id:0:全部 -10:云收藏 -15:消息备忘

  • only_public: 0 | 1 = <default>

  • msg_note: 0 | 1 = <default>

  • has_picknews: 0 | 1 = <default>

note_save(payload: str | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_save(payload: str | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

保存备忘(记录/笔记/记事)

POST https://note.115.com/?ct=note&ac=save

Payload:
  • nid: int = <default> 💡 记录 id,如果提供就是更新,否则就是新建

  • content: str = <default> 💡 记录的文本,最多 50000 个字符

  • title: str = <default> 💡 标题,最多 927 个字节,可以为空

  • cid: int = 0 💡 分类 id

  • is_html: 0 | 1 = 0 💡 是否 HTML,如果为 1,则会自动加上标签(例如 <p>),以使内容成为合法的 HTML

  • pickcodes: str = <default> 💡 附件的提取码,多个用逗号 “,” 隔开

  • tags: str = <default> 💡 标签文本

  • tags[]: str = <default> 💡 标签文本(多个用 “[]” 后缀)

  • tags[0]: str = <default> 💡 标签文本(多个用 “[0]”,”[1]”,… 后缀)

  • tags[1]: str = <default> 💡 标签文本

  • toc_ids: int | str = <default>

note_save2(payload: str | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_save2(payload: str | dict | list, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

编辑备忘(记录/笔记/记事)

POST https://note.115.com/api/2.0/api.php?ac=note_edit

Payload:
  • nid: int = <default> 💡 记录 id,如果提供就是更新,否则就是新建

  • content: str = <default> 💡 记录的文本,最多 50000 个字符

  • title: str = <default> 💡 标题,最多 927 个字节,可以为空

  • cid: int = <default> 💡 分类 id

  • is_html: 0 | 1 = <default> 💡 是否 HTML,如果为 1,则会自动加上标签(例如 <p>),以使内容成为合法的 HTML

  • pickcodes: str = <default> 💡 附件的提取码,多个用逗号 “,” 隔开

  • tags: str = <default> 💡 标签文本

  • tags[]: str = <default> 💡 标签文本(多个用 “[]” 后缀)

  • tags[0]: str = <default> 💡 标签文本(多个用 “[0]”,”[1]”,… 后缀)

  • tags[1]: str = <default> 💡 标签文本

note_search(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

搜索备忘(记录/笔记/记事)

Note

这个接口支持 GET 和 POST 请求方法

GET https://note.115.com/api/2.0/api.php?ac=search

Payload:
  • q: str 💡 搜索词

  • start: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 最多返回数量

  • count: int = <default>

  • cid: int = 0 💡 分类 id

  • has_picknews: 0 | 1 = 1 💡 是否显示 id 为负数的分类

  • create_time1: str = <default>

  • create_time2: str = <default>

  • start_time: str = <default> 💡 开始日期,格式为 YYYY-MM-DD

  • end_time: str = <default> 💡 结束日期(含),格式为 YYYY-MM-DD

  • tag_arr: str = <default> 💡 标签文本

  • tag_arr[]: str = <default> 💡 标签文本(多个用 “[]” 后缀)

  • tag_arr[0]: str = <default> 💡 标签文本(多个用 “[0]”,”[1]”,… 后缀)

  • tag_arr[1]: str = <default> 💡 标签文本

note_set_cate(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_set_cate(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改记录的分类

POST https://note.115.com/?ct=note&ac=update_note_cate

Payload:
  • cid: int 💡 分类 id

  • nid: int | str 💡 记录 id,多个用逗号 “,” 隔开

note_set_cate2(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_set_cate2(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改记录的分类

POST https://note.115.com/api/2.0/api.php?ac=set_note_cate

Payload:
  • cid: int 💡 分类 id

  • nid: int | str 💡 记录 id,多个用逗号 “,” 隔开

note_set_tag(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_set_tag(payload: dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改记录的标签

POST https://note.115.com/api/2.0/api.php?ac=set_tag

Payload:
  • nid: int 💡 记录 id

  • tags: str 💡 标签文本

  • tags[]: str 💡 标签文本(多个用 “[]” 后缀)

  • tags[0]: str 💡 标签文本(多个用 “[0]”,”[1]”,… 后缀)

  • tags[1]: str 💡 标签文本

  • has_picknews: 0 | 1 = <default>

note_tag_color(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_tag_color(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

上传标签,返回标签并提供颜色

POST https://note.115.com/api/2.0/api.php?ac=get_tag_color

Payload:
  • tags: str = <default> 💡 标签文本

  • tags[]: str = <default> 💡 标签文本(多个用 “[]” 后缀)

  • tags[0]: str = <default> 💡 标签文本(多个用 “[0]”,”[1]”,… 后缀)

  • tags[1]: str = <default> 💡 标签文本

note_tag_latest(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_tag_latest(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取最近使用的标签

Note

这个接口支持 GET 和 POST 请求方法

GET https://note.115.com/api/2.0/api.php?ac=get_latest_tags

Payload:
  • q: str = “” 💡 搜索词

  • is_return_color: 0 | 1 = 1 💡 是否返回颜色

  • limit: int = 1150 💡 最多返回数量

note_user_setting(base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_user_setting(base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取记录的列表展示的配置(目前只有【每页数量设置】)

GET https://note.115.com/?ct=note&ac=get_user_setting

note_user_setting_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
note_user_setting_set(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://note.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改记录的列表展示的配置

POST https://note.115.com/?ct=note&ac=set_user_setting

Payload:
  • note_page_size: 20 | 25 | 50 | 100 💡 每页数量设置

photo_album(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_album(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取相册信息

GET https://webapi.115.com/photo/album

Payload:
  • album_id: int | str 💡 相册 id,如果为 -1,则是【默认加密相册】

photo_album_add(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_album_add(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建相册

POST https://webapi.115.com/photo/albumadd

Payload:
  • album_name: str = <default> 💡 相册名称

  • album_desc: str = <default> 💡 相册描述

  • is_secret: 0 | 1 = <default> 💡 是否加密

photo_album_group(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_album_group(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取相册分组

GET https://webapi.115.com/photo/albumgroup

Payload:
  • home_page: 0 | 1 = 1

  • limit: int = 100

photo_album_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_album_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取相册列表

GET https://webapi.115.com/photo/albumlist

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 9999 💡 最多返回数量

  • album_type: int = 1💡 相册类型。已知:

    • 1: 个人相册

    • 5: 应用相册

    • 6: 加密相册

photo_album_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_album_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

更新相册

POST https://webapi.115.com/photo/album

Payload:
  • album_id: int | str 💡 相册 id,如果为 -1,则是【默认加密相册】

  • album_name: str = <default> 💡 相册名称

  • album_desc: str = <default> 💡 相册描述

  • album_state: 0 | 1 = <default> 💡 是否删除:0:保留 1:删除

  • is_secret: 0 | 1 = <default> 💡 是否加密

photo_bind(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_bind(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

把图片或视频转存到相册

POST https://webapi.115.com/photo/photo

Note

虽然被认为是图片的格式很多(你可以用这个方法 client.fs_files_second_type({“type”: 2}) 获得网盘中的所有图片格式),但仅支持以下格式图片添加到相册:jpg,jpeg,png,gif,svg,webp,heic,bmp,dng

Caution

添加到相册,其实就是复制到 “/手机相册” 目录,如果需要删除,就直接用 fs_delete 即可

Payload:
  • file_ids: int | str 💡 文件 id,多个用逗号 “,” 隔开

  • to_album_id: int | str = 1 💡 相册 id

    • -1: 添加到【默认加密相册】

    • 1: 添加到照片

  • action: str = “addtoalbum” 💡 动作

    • “addtoalbum”: 添加到相册

photo_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取相册的文件列表

GET https://webapi.115.com/photo/photolist

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 最多返回数量

  • album_id: int | str = <default> 💡 相册 id。如果为 -1,则是【默认加密相册】;如果不指定,则是所有相册

  • key_word: str = <default>

  • type: int = <default>

  • tr: str = <default> 💡 时间线,是一个日期,格式为 YYYYMMDD

  • order: str = <default> 💡 排序依据,例如 “add_time”

  • is_asc: 0 | 1 = <default> 💡 是否升序排列

photo_share_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_share_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享相册的图片列表

GET https://webapi.115.com/photo/sharephotolist

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 最多返回数量

  • album_id: int | str = <default> 💡 相册 id

  • record_id: int | str = <default> 💡 操作记录 id

  • key_word: str = <default>

  • type: int = <default>

  • tr: str = <default> 💡 时间线,是一个日期,格式为 YYYYMMDD

  • order: str = <default> 💡 排序依据,例如 “add_time”

  • is_asc: 0 | 1 = <default> 💡 是否升序排列

photo_share_remove(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_share_remove(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

把共享相册的图片移除

POST https://webapi.115.com/photo/sharephoto

Payload:
  • album_id: int | str 💡 相册 id

  • photo_ids: int | str = <default> 💡 (在相册中的)图片 id,多个用逗号 “,” 隔开

photo_share_save(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_share_save(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

把共享相册的图片保存到照片库

POST https://webapi.115.com/photo/sharephotosave

Payload:
  • album_id: int | str 💡 相册 id

  • photo_ids: int | str = <default> 💡 (在相册中的)图片 id,多个用逗号 “,” 隔开

photo_share_timeline(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_share_timeline(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享相册的时间线列表,然后你可以通过 client.photo_share_list 获取对应时间线的图片列表

GET https://webapi.115.com/photo/sharephototimeline

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 99999 💡 最多返回数量

  • album_id: int | str = <default> 💡 相册 id。如果为 -1,则是【默认加密相册】;如果不指定,则是所有相册

  • key_word: str = <default>

photo_sharealbum(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享相册信息

GET https://webapi.115.com/photo/sharealbum

Payload:
  • album_id: int | str 💡 相册 id

photo_sharealbum_add(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum_add(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建共享相册

POST https://webapi.115.com/photo/sharealbumadd

Payload:
  • album_name: str = <default> 💡 相册名称

  • album_desc: str = <default> 💡 相册描述

photo_sharealbum_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享相册列表

GET https://webapi.115.com/photo/sharealbumlist

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 最多返回数量

  • is_asc: 0 | 1 = <default> 💡 是否升序排列

  • order: str = <default> 💡 排序依据,例如 “update_time”

photo_sharealbum_member(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum_member(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享相册的成员用户列表

GET https://webapi.115.com/photo/sharealbummember

Payload:
  • album_id: int | str = <default> 💡 相册 id

  • order: str = <default> 💡 排序依据,例如 “join_time”

  • is_asc: 0 | 1 = <default> 💡 是否升序排列

photo_sharealbum_record_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum_record_list(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享相册的操作记录列表

GET https://webapi.115.com/photo/sharealbumrecordlist

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 1150 💡 最多返回数量

  • album_id: int | str = <default> 💡 相册 id

photo_sharealbum_record_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum_record_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

在共享相册中增加或删除 1 条记录

POST https://webapi.115.com/photo/sharealbumrecord

Payload:
  • album_id: int | str 💡 相册 id

  • action: “add” | “del” 💡 操作。”add”:添加记录 “del”:删除记录

  • record_id: int | str = <default> 💡 记录 id

  • record_content: str = <default> 💡 记录的描述文本

  • file_ids: int | str = <default> 💡 记录关联的(在网盘中的)文件 id,多个用逗号 “,” 隔开

photo_sharealbum_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_sharealbum_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

更新共享相册

POST https://webapi.115.com/photo/sharealbum

Payload:
  • album_id: int | str 💡 相册 id

  • album_name: str = <default> 💡 相册名称

  • album_desc: str = <default> 💡 相册描述

  • album_cover: str = <default> 💡 相册封面,图片的 sha1 值

  • album_state: 0 | 1 = <default> 💡 是否删除:0:保留 1:删除

  • is_top: 0 | 1 = <default> 💡 是否置顶

  • user_nick_name: str = <default> 💡 用户昵称

photo_timeline(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
photo_timeline(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取时间线列表,然后你可以通过 client.photo_list 获取对应时间线的图片列表

GET https://webapi.115.com/photo/phototimeline

Payload:
  • offset: int = 0 💡 开始索引,从 0 开始

  • limit: int = 99999 💡 最多返回数量

  • album_id: int | str = <default> 💡 相册 id。如果为 -1,则是【默认加密相册】;如果不指定,则是所有相册

  • key_word: str = <default>

recyclebin_clean(payload: int | str | Iterable[int | str] | dict = '', /, password: str = '000000', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_clean(payload: int | str | Iterable[int | str] | dict = '', /, password: str = '000000', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:删除或清空

POST https://webapi.115.com/rb/secret_del

Note

只要不指定 tid,就会清空回收站,如果有目录正在删除中则会被阻止

Note

可以在设置中的【账号安全/安全密钥】页面下,关闭【文件(隐藏模式/清空删除回收站)】的按钮,就不需要传安全密钥了

Payload:
  • tid: int | str = “” 💡 不传就是清空,多个用逗号 “,” 隔开

  • password: int | str = “000000” 💡 安全密钥,是 6 位数字

recyclebin_clean2(payload: int | str | Iterable[int | str] | dict = '', /, password: str = '000000', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_clean2(payload: int | str | Iterable[int | str] | dict = '', /, password: str = '000000', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:删除或清空

POST https://webapi.115.com/rb/clean

Note

如果没有指定任一 rid,就是清空回收站,如果有目录正在删除中则会被阻止

Tip

这个接口必须提供安全密钥。如果不提供,则默认使用 “000000”,在不必要的情况下,完全可以把安全密钥设为这个值

Payload:
  • rid[0]: int | str 💡 不传就是清空

  • rid[1]: int | str

  • password: int | str = “000000” 💡 安全密钥

recyclebin_clean_app(payload: int | str | Iterable[int | str] | dict = '', /, password: str = '000000', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_clean_app(payload: int | str | Iterable[int | str] | dict = '', /, password: str = '000000', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:删除或清空

POST https://proapi.115.com/{app}/rb/secret_del

Note

只要不指定 tid,就是清空回收站,如果有目录正在删除中则会被阻止

Note

可以在设置中的【账号安全/安全密钥】页面下,关闭【文件(隐藏模式/清空删除回收站)】的按钮,就不需要传安全密钥了

Payload:
  • tid: int | str = “” 💡 不传就是清空,多个用逗号 “,” 隔开

  • password: int | str = “000000” 💡 安全密钥,是 6 位数字

  • user_id: int | str = <default> 💡 用户 id

recyclebin_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:文件信息

POST https://webapi.115.com/rb/rb_info

Payload:
  • rid: int | str

recyclebin_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:列表

GET https://webapi.115.com/rb

Payload:
  • aid: int = 7 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • cid: int | str = 0

  • limit: int = 32

  • offset: int = 0

  • o: str = <default> 💡 排序依据:dtime:删除时间

  • asc: 0 | 1 = <default>

  • source: str = <default>

recyclebin_list_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_list_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:列表

GET https://proapi.115.com/{app}/rb

Payload:
  • aid: int = 7 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • cid: int | str = 0

  • limit: int = 32

  • offset: int = 0

  • source: str = <default>

recyclebin_revert(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_revert(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:还原

POST https://webapi.115.com/rb/revert

Payload:
  • rid[0]: int | str

  • rid[1]: int | str

recyclebin_revert_app(payload: int | str | Iterable[int | str] | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_revert_app(payload: int | str | Iterable[int | str] | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:还原

POST https://proapi.115.com/{app}/rb/revert

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • tid: int | str 💡 多个用逗号 “,” 隔开

  • user_id: int | str = <default> 💡 用户 id

share_access_user_list(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_access_user_list(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

访问账号列表

GET https://webapi.115.com/share/access_user_list

Payload:
  • share_code: str

share_activate(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_activate(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

激活分享

POST https://webapi.115.com/share/activeshare

Payload:
  • share_code: str

share_batch_renewal_long_skip(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_batch_renewal_long_skip(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

将免登录下载链接设为长期

POST https://webapi.115.com/share/batch_renewal_long_skip

Attention

链接必须开启免登录下载,并且需年费及以上 VIP 会员

Payload:
  • share_code: str

share_batch_skip_login_down(payload: str | Iterable[str] | dict, /, skip_login: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_batch_skip_login_down(payload: str | Iterable[str] | dict, /, skip_login: bool = True, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

批量开启或关闭免登录下载

POST https://webapi.115.com/share/batch_skip_login_down

Attention

链接必须开启免登录下载,并且需年费及以上 VIP 会员

Payload:
  • share_code: str 💡 分享码,多个用逗号 “,” 隔开

  • skip_login: 0 | 1 = 1 💡 是否允许免登录下载

share_downlist(payload: int | str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_downlist(payload: int | str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享链接的某个目录中可下载的文件的列表(只含文件,不含目录,任意深度,简略信息)

GET https://webapi.115.com/share/downlist

Attention

cid 不能为 0 或 空

Payload:
  • share_code: str

  • receive_code: str

  • cid: int | str

share_downlist_app(payload: int | str | dict, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_downlist_app(payload: int | str | dict, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享链接的某个目录中可下载的文件的列表(只含文件,不含目录,任意深度,简略信息)

GET https://proapi.115.com/app/share/downlist

Attention

cid 不能为 0 或 空

Payload:
  • share_code: str

  • receive_code: str

  • cid: int | str

share_download_url(payload: int | str | dict, /, share_url: str = '', strict: bool = True, app: str = 'android', *, async_: Literal[False] = False, **request_kwargs) P115URL[source]
share_download_url(payload: int | str | dict, /, share_url: str = '', strict: bool = True, app: str = 'android', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115URL]

获取分享链接中某个文件的下载链接

Parameters:
  • payload

    请求参数,如果为 int 或 str,则视为 file_id

    • file_id: int | str 💡 文件 id

    • receive_code: str 💡 接收码(也就是密码)

    • share_code: str 💡 分享码

  • url – 分享链接,如果提供的话,会被拆解并合并到 payload 中,优先级较高

  • strict – 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常

  • app – 使用此设备的接口

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

share_download_url_app(payload: int | str | dict, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_download_url_app(payload: int | str | dict, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享链接中某个文件的下载链接

POST https://proapi.115.com/app/share/downurl

Payload:
  • file_id: int | str

  • receive_code: str

  • share_code: str

  • dl: 0 | 1 = <default>

share_download_url_web(payload: int | str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_download_url_web(payload: int | str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享链接中某个文件的下载链接(网页版接口)

GET https://webapi.115.com/share/downurl

Note

最大允许下载 200 MB 的文件

Payload:
  • file_id: int | str

  • receive_code: str

  • share_code: str

  • dl: int = <default>

share_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取(自己的)分享信息

GET https://webapi.115.com/share/shareinfo

Payload:
  • share_code: str

share_info_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_info_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取(自己的)分享信息

GET https://proapi.115.com/{app}/2.0/share/shareinfo

Payload:
  • share_code: str

share_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列(自己的)分享信息列表

GET https://webapi.115.com/share/slist

Todo

暂时不清楚 order 有哪些取值

Payload:
  • limit: int = 32

  • offset: int = 0

  • order: str = <default> 💡 排序依据,例如 “create_time”

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • show_cancel_share: 0 | 1 = 0

  • share_state: int = <default>

share_list_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_list_app(payload: int | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

罗列(自己的)分享信息列表

GET https://proapi.115.com/{app}/2.0/share/slist

Payload:
  • limit: int = 32

  • offset: int = 0

share_notlogin_dl_quota(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_notlogin_dl_quota(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

免登录下载流量配额

GET https://webapi.115.com/user/notlogin_dl_quota

share_notlogin_dl_quota_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_notlogin_dl_quota_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

免登录下载流量配额

GET https://proapi.115.com/{app}/2.0/user/notlogin_dl_quota

share_receive(payload: int | str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_receive(payload: int | str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

接收分享链接的某些文件或目录

POST https://webapi.115.com/share/receive

Payload:
  • share_code: str

  • receive_code: str

  • file_id: int | str 💡 有多个时,用逗号 “,” 分隔

  • cid: int | str = <default> 💡 这是你网盘的目录 cid,如果不指定则用默认

  • is_check: 0 | 1 = <default>

  • target_folder: str = <default>

share_receive_app(payload: int | str | dict, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_receive_app(payload: int | str | dict, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

接收分享链接的某些文件或目录

POST https://proapi.115.com/{app}/2.0/share/receive

Payload:
  • share_code: str

  • receive_code: str

  • file_id: int | str 💡 有多个时,用逗号 “,” 分隔

  • cid: int | str = <default> 💡 这是你网盘的目录 cid,如果不指定则用默认

  • is_check: 0 | 1 = <default>

share_recvcode(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_recvcode(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

取消访问码

GET https://webapi.115.com/share/recvcode

Payload:
  • share_code: str

  • action: str = “cancel”

share_recvcode_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_recvcode_app(payload: str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

取消访问码

GET https://proapi.115.com/{app}/2.0/share/recvcode

Payload:
  • share_code: str

  • action: str = “cancel”

share_reshare(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_reshare(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

续期分享

POST https://webapi.115.com/share/reshare

Payload:
  • share_code: str

  • ignore_warn: 0 | 1 = 1 💡 忽略信息提示,传 1 就行了

  • renewal_skip_login: str = <default>

share_search(payload: str | dict, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

从分享链接搜索文件或目录

GET https://webapi.115.com/share/search

Attention

最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000,不过可以一次性取完

Payload:
  • share_code: str 💡 分享码

  • receive_code: str 💡 接收码(即密码),如果是自己的分享,则不用传

  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 一页大小,意思就是 page_size

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • search_value: str = “.” 💡 搜索文本,仅支持搜索文件名

  • suffix: str = <default> 💡 文件后缀(扩展名),优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 99: 所有文件

share_send(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_send(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

创建(自己的)分享

POST https://webapi.115.com/share/send

Payload:
  • file_ids: int | str 💡 文件列表,有多个用逗号 “,” 隔开

  • is_asc: 0 | 1 = 1 💡 是否升序排列

  • order: str = “file_name” 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • ignore_warn: 0 | 1 = 1 💡 忽略信息提示,传 1 就行了

share_send_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_send_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

创建(自己的)分享

POST https://proapi.115.com/{app}/2.0/share/send

Payload:
  • file_ids: int | str 💡 文件列表,有多个用逗号 “,” 隔开

  • is_asc: 0 | 1 = 1 💡 是否升序排列

  • order: str = “file_name” 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • ignore_warn: 0 | 1 = 1 💡 忽略信息提示,传 1 就行了

share_setting(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_setting(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享设置

GET https://webapi.115.com/share/setting

share_skip_login_check(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_skip_login_check(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检查是否可免登录下载

POST https://webapi.115.com/share/is_skip_login

Payload:
  • share_code: str 💡 分享码

  • receive_code: str 💡 接收码(访问密码)

  • file_id: int | str = 1 💡 文件 id(可以随便填一个非 0 的值)

share_skip_login_down(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_skip_login_down(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

开启或关闭免登录下载

POST https://webapi.115.com/share/skip_login_down

Payload:
  • share_code: str 💡 分享码

  • skip_login: 0 | 1 = 1 💡 是否开启

share_skip_login_down_details(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_skip_login_down_details(payload: str | dict = '', /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

流量消耗明细

GET https://webapi.115.com/share/skip_login_down_details

Payload:
  • start_time: str = <default> 💡 开始时间,格式为 “YYYY-MM-DD hh:mm:ss”,默认为今天零点

  • end_time: str = <default> 💡 结束时间(含),默认为明天零点

  • share_code: str = “” 💡 分享码,如果为空则统计所有分享

  • offset: int = 0

  • limit: int = 32

share_skip_login_down_first(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_skip_login_down_first(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

免登录下载信息

GET https://webapi.115.com/share/skip_login_down_first

Payload:
  • share_code: str 💡 分享码

share_skip_login_download_url(payload: None | int | str | dict = None, /, share_url: str = '', strict: bool = True, app: str = 'chrome', *, async_: Literal[False] = False, **request_kwargs) P115URL[source]
share_skip_login_download_url(payload: None | int | str | dict = None, /, share_url: str = '', strict: bool = True, app: str = 'chrome', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115URL]

获取分享链接中某个文件的下载链接

Note

可以作为 staticmethod 使用

Parameters:
  • payload

    请求参数,如果为 int 或 str,则视为 file_id

    • file_id: int | str 💡 文件 id

    • receive_code: str 💡 接收码(访问密码)

    • share_code: str 💡 分享码

  • share_url – 分享链接,如果提供的话,会被拆解并合并到 payload 中,优先级较高

  • strict – 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常

  • app – 使用此设备的接口

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

share_skip_login_download_url_app(payload: None | int | str | dict = None, /, share_url: str = '', app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_skip_login_download_url_app(payload: None | int | str | dict = None, /, share_url: str = '', app: str = 'chrome', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取免登录下载链接

POST https://proapi.115.com/app/share/skip_login_downurl

Note

可以作为 staticmethod 使用

Payload:
  • file_id: int | str

  • receive_code: str

  • share_code: str

share_skip_login_download_url_web(payload: None | int | str | dict = None, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_skip_login_download_url_web(payload: None | int | str | dict = None, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取免登录下载链接

POST https://webapi.115.com/share/skip_login_downurl

Note

可以作为 staticmethod 使用

Payload:
  • share_code: str 💡 分享码

  • receive_code: str 💡 接收码(访问密码)

  • file_id: int | str 💡 文件 id

share_snap(payload: int | str | dict = 0, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_snap(payload: int | str | dict = 0, /, share_url: str = '', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享链接的某个目录中的文件和子目录的列表(包含详细信息)

GET https://webapi.115.com/share/snap

Note

可以作为 staticmethod 使用

如果是登录状态,且查看自己的分享时,则可以不提供 receive_code,而且即使还在审核中,也能获取文件列表

Caution

虽然可以不登录即可获取数据,但是一旦过于频繁,会封禁 IP 一段时间

Payload:
  • share_code: str

  • receive_code: str

  • cid: int | str = 0

  • limit: int = 32

  • offset: int = 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “user_ptime”: 创建时间/修改时间

share_snap_app(payload: int | str | dict = 0, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_snap_app(payload: int | str | dict = 0, /, share_url: str = '', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取分享链接的某个目录中的文件和子目录的列表(包含详细信息)

GET https://proapi.115.com/{app}/2.0/share/snap

Caution

这个接口必须登录使用,并且对于其它人的网盘文件,每个目录中最多获取前 1000 条(但获取自己的资源正常)

Payload:
  • share_code: str

  • receive_code: str

  • cid: int | str = 0

  • limit: int = 32

  • offset: int = 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “user_ptime”: 创建时间/修改时间

share_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

变更(自己的)分享的配置(例如改访问密码,取消分享)

POST https://webapi.115.com/share/updateshare

Payload:
  • share_code: str 💡 分享码,多个用逗号 “,” 隔开

  • receive_code: str = <default> 💡 接收码(访问密码)

  • share_duration: int = <default> 💡 分享天数: n(填入指定天数),-1(长期)

  • is_custom_code: 0 | 1 = <default> 💡 用户自定义口令(不用管)

  • auto_fill_recvcode: 0 | 1 = <default> 💡 分享链接自动填充口令(不用管)

  • auto_renewal: 0 | 1 = <default> 💡 是否自动续期

  • share_channel: int = <default> 💡 分享渠道代码(不用管)

  • action: str = <default> 💡 操作: “cancel”:取消分享 “delete”:删除分享

  • skip_login_down_flow_limit: “” | int = <default> 💡 设置免登录下载限制流量,如果为 “” 则不限,单位: 字节

  • access_user_ids = int | str = <default> 💡 设置访问账号,多个用逗号 “,” 隔开

  • receive_user_limit: int = <default> 💡 接收次数

  • reset_receive_user: 0 | 1 = <default> 💡 重置接收次数

share_update_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
share_update_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

变更(自己的)分享的配置(例如改访问密码,取消分享)

POST https://proapi.115.com/{app}/2.0/share/updateshare

Payload:
  • share_code: str 💡 分享码,多个用逗号 “,” 隔开

  • receive_code: str = <default> 💡 接收码(访问密码)

  • share_duration: int = <default> 💡 分享天数: n(填入指定天数),-1(长期)

  • is_custom_code: 0 | 1 = <default> 💡 用户自定义口令(不用管)

  • auto_fill_recvcode: 0 | 1 = <default> 💡 分享链接自动填充口令(不用管)

  • share_channel: int = <default> 💡 分享渠道代码(不用管)

  • action: str = <default> 💡 操作: “cancel”:取消分享 “delete”:删除分享

  • skip_login_down_flow_limit: “” | int = <default> 💡 设置免登录下载限制流量,如果为 “” 则不限,单位: 字节

  • access_user_ids = int | str = <default> 💡 设置访问账号,多个用逗号 “,” 隔开

  • receive_user_limit: int = <default> 💡 接收次数

  • reset_receive_user: 0 | 1 = <default> 💡 重置接收次数

tool_clear_empty_folder(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_clear_empty_folder(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除空目录

GET https://115.com/?ct=tool&ac=clear_empty_folder

tool_repeat(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_repeat(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

开始一键排重任务

POST https://aps.115.com/repeat/repeat.php

Payload:
  • folder_id: int | str 💡 目录 id,对应 parent_id

tool_repeat_delete(payload: dict, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_repeat_delete(payload: dict, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除重复文件

POST https://aps.115.com/repeat/repeat_delete.php

Payload:
  • filter_field: “parents” | “file_name” | “” | “” = <default> 💡 保留条件(1. 用于批量删除)

    • “file_name”: 文件名(按长度)

    • “parents”: 所在目录路径(按长度)

    • “user_utime”: 操作时间

    • “user_ptime”: 创建时间

  • filter_order: “asc” | “desc” = <default> 💡 排序(2. 用于批量删除)

    • “asc”: 升序,从小到大,取最小

    • “desc”: 降序,从大到小,取最大

  • batch: 0 | 1 = <default> 💡 是否批量操作(3. 用于批量删除)

  • sha1s[{sha1}]: int | str = <default> 💡 文件 id,多个用逗号 “,” 隔开(1. 用于手动指定删除对象)

tool_repeat_delete_status(base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_repeat_delete_status(base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除重复文件进度和统计信息(status 为 False 表示进行中,为 True 表示完成)

GET https://aps.115.com/repeat/delete_status.php

tool_repeat_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_repeat_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取重复文件列表

GET https://aps.115.com/repeat/repeat_list.php

Payload:
  • s: int = 0 💡 offset,从 0 开始

  • l: int = 100 💡 limit

tool_repeat_status(base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_repeat_status(base_url: str | Callable[[], str] = 'https://aps.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

查询一键排重任务进度和统计信息(status 为 False 表示进行中,为 True 表示完成)

GET https://aps.115.com/repeat/repeat_status.php

tool_space(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
tool_space(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

检验空间

GET https://115.com/?ct=tool&ac=space

Hint

  1. 校验空间需全局进行扫描,请谨慎操作;

  2. 扫描出无父目录的文件将统一放入到”/修复文件”的目录中;

  3. “/修复文件”的目录若超过存放文件数量限制,将创建多个目录存放,避免无法操作。

  4. 此接口一天只能使用一次

upload_avatar(file: Buffer | str | PathLike | SupportsRead | Iterable[Buffer], app: str = 'web', base_url: str | Callable[[], str] = 'https://ictxl.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_avatar(file: Buffer | str | PathLike | SupportsRead | Iterable[Buffer] | AsyncIterable[Buffer], app: str = 'web', base_url: str | Callable[[], str] = 'https://ictxl.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

上传一张图片,可用于作为头像(图片时效性很短,请尽快使用)

POST https://ictxl.115.com/app/1.1/{app}/1.2/upload/set_avatar

Attention

此接口采用 multi-part 上传,其实是可以一次传多个文件的,但我做的封装只允许传一张图片。

一次接口调用的上传流量,算上分片分隔符,大概是不能超过 32 MB,需要进一步测验。

Parameters:
  • file – 待上传的文件

  • app – 使用此设备的接口

  • base_url – 接口的基地址

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_avatar2(file: Buffer | str | PathLike, app: str = 'web', base_url: str | Callable[[], str] = 'https://job.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_avatar2(file: Buffer | str | PathLike, app: str = 'web', base_url: str | Callable[[], str] = 'https://job.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

上传一张图片,可用于作为头像

POST https://job.115.com/api/1.0/{app}/26.0/5/upload/avatar

Parameters:
  • file – 待上传的文件数据

  • app – 使用此设备的接口

  • base_url – 接口的基地址

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_chat_image(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead | Iterable[Buffer], pid: int | str = 'U_3_-1', share_id: int = 0, filename: str = '1.jpg', dirname: str = '', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_chat_image(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead | Iterable[Buffer] | AsyncIterable[Buffer], pid: int | str = 'U_3_-1', share_id: int = 0, filename: str = '1.jpg', dirname: str = '', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

聊天窗口中上传一张图片

Caution

不支持秒传,但也不必传文件大小和 sha1,最大支持上传 50 MB 的文件

Note

target 随便设置,例如 "U_3_-1""U_4_-1""U_5_-2""U_3_-10"

Parameters:
  • file – 待上传的文件

  • pid – 上传文件到此目录的 id 或 pickcode,或者指定的 target(格式为 f"U_{aid}_{pid}"f"S_{share_id}_{pid}"

  • share_id – 共享 id

  • filename – 文件名,如果为空,则会自动确定

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_chat_image_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_chat_image_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

聊天窗口中上传图片接口的初始化

POST https://115.com/api/chat/image/upload

Caution

此接口不支持秒传,最大支持上传 50 MB 的文件,上传成功后不占用空间

Caution

通过扩展名来识别,仅支持以下格式图片(jpg,jpeg,png,gif,svg,webp,heic,bmp,dng)

Note

target 随便设置,例如 "U_3_-1""U_4_-1""U_5_-2""U_3_-10"

Payload:
  • filename: str = <default> 💡 文件名,默认为一个新的 uuid4 对象的字符串表示

  • target: str = "U_3_-1" 💡 上传目标,格式为 f"U_{aid}_{pid}"

  • filesize: int | str = <default> 💡 图片大小

  • height: int = <default> 💡 图片高度

  • width: int = <default> 💡 图片宽度

upload_file(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead, pid: int | str = 0, share_id: int = 0, filename: str = '', filesha1: str = '', filesize: int = -1, dirname: str = '', payload: None | Mapping = None, partsize: int = 0, callback: None | dict = None, upload_id: str = '', endpoint: str = 'https://oss-cn-shenzhen.aliyuncs.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_file(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead, pid: int | str = 0, share_id: int = 0, filename: str = '', filesha1: str = '', filesize: int = -1, dirname: str = '', payload: None | Mapping = None, partsize: int = 0, callback: None | dict = None, upload_id: str = '', endpoint: str = 'https://oss-cn-shenzhen.aliyuncs.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

上传文件

Note

如果提供了 callback,则强制为分块上传。 此时,最好提供一下 upload_id,否则就是从头开始。 此时可以省略 pidfilenamefilesha1filesizeuser_iduser_keypartsize

Caution

partsize > 0 时,不要把 partsize 设置得太小,起码得 10 MB (10485760) 以上

Note

这个文件无论把文件传到哪,都会占用空间。这里有一些特殊的位置:

  • U_3_-8: 此时 aid=120,会平白占用空间,根本不能回收,所以要慎用

  • U_3_-9: 此时 aid=12,可以通过 fs_delete_app 删除上传后的文件 id 来释放空间

Parameters:
  • file – 待上传的文件

  • pid – 上传文件到此目录的 id 或 pickcode,或者指定的 target(格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”,但这里的 aid 无论如何取值,都视为 1)

  • share_id – 共享 id

  • filename – 文件名,如果为空,则会自动确定

  • filesha1 – 文件的 sha1,如果为空,则会自动确定

  • filesize – 文件大小,如果为 -1,则会自动确定

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • payload – 其它的查询参数

  • partsize – 分块上传的分块大小。如果为 0,则不做分块上传;如果 < 0,则会自动确定

  • callback – 回调数据

  • upload_id – 上传任务 id

  • endpoint – 上传目的网址

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_file_image(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead | Iterable[Buffer], pid: int | str = 'U_4_-1', share_id: int = 0, filename: str = '1.jpg', dirname: str = '', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_file_image(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead | Iterable[Buffer] | AsyncIterable[Buffer], pid: int | str = 'U_4_-1', share_id: int = 0, filename: str = '1.jpg', dirname: str = '', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

网页端的上传图片接口

Caution

不支持秒传,但也不必传文件大小和 sha1,最大支持上传 50 MB 的文件

Note

target 随便设置,例如 "U_3_-1""U_4_-1""U_5_-2""U_3_-10"

Parameters:
  • file – 待上传的文件

  • pid – 上传文件到此目录的 id 或 pickcode,或者指定的 target(格式为 f"U_{aid}_{pid}"f"S_{share_id}_{pid}"

  • share_id – 共享 id

  • filename – 文件名,如果为空,则会自动确定

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_file_init(filename: str, filesha1: str, filesize: int, dirname: str = '', read_range_bytes_or_hash: None | Callable[[str], str | Buffer] = None, pid: int | str = 0, share_id: int = 0, payload: None | Mapping = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_file_init(filename: str, filesha1: str, filesize: int, dirname: str = '', read_range_bytes_or_hash: None | Callable[[str], str | Buffer] = None, pid: int | str = 0, share_id: int = 0, payload: None | Mapping = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

初始化上传,可能秒传,此接口是对 upload_init 的封装

Note

  • 文件大小 和 sha1 是必需的,只有 sha1 是没用的。

  • 如果文件大于等于 1 MB (1048576 B),就需要 2 次检验一个范围哈希,就必须提供 read_range_bytes_or_hash

Parameters:
  • filename – 文件名

  • filesize – 文件大小

  • filesha1 – 文件的 sha1

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • read_range_bytes_or_hash – 调用以获取 2 次验证的数据或计算 sha1,接受一个数据范围,格式符合: HTTP Range Requests, 返回值如果是 str,则视为计算好的 sha1,如果为 Buffer,则视为数据(之后会被计算 sha1)

  • pid – 上传文件到此目录的 id,或者指定的 target(格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”,但这里的 aid 无论如何取值,都视为 1)

  • share_id – 共享 id

  • payload – 其它的查询参数

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_file_sample(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead | Iterable[Buffer], pid: int | str = 0, share_id: int = 0, filename: str = '', dirname: str = '', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_file_sample(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead | Iterable[Buffer] | AsyncIterable[Buffer], pid: int | str = 0, share_id: int = 0, filename: str = '', dirname: str = '', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

网页端的上传接口

Caution

不支持秒传,但也不必传文件大小和 sha1

Note

如果上传到共享目录,占用的是创建者的网盘空间

Note

只要上传后的 aidarea_id 不为 1,则不占用空间,这是 upload_file 所不能的(因为即使指定了 "U_{aid}_{pid}",也会忽略其中的 aid,强行视为 1)

Note

如果我们把文件名分成两部分,名字 + 扩展名(含前缀点号 .),那么就有以下限制:

  1. 如果只有名字,最长 255 字节,超出则截掉尾部

  2. 如果只有扩展名,最长 255 字节,超出则截掉尾部

  3. 如果两者皆有,则情况比较复杂:

    1. (😯 这属于通常情况了)如果扩展名长度 <= 253 字节,则总长度不超过 255 字节,名字的超出部分会被替换为两个点号 ..,占用 2 个字节

    2. (😂 特意构造或者误断)如果扩展名长度 > 253 字节,允许的长度上限至少是 512 字节,又会有几套限制规则(具体会是哪一个,我目前还比较迷糊):

      1. 总长不超过 552 字节,超出部分会直接截掉名字的尾部,仍然不够则再截掉扩展名的尾部,此时只有 552 字节的扩展名部分

      2. 总长不超过 512 字节,超出部分会直接截掉名字的尾部

      3. 总长不超过 512 字节,超出部分会直接截掉名字的尾部并替换为 2 个点号 ..,仍然不够则再截掉扩展名的尾部,极端情况下,扩展名为 510 字节,名字部分变成两个点号 ..,占 2 字节

      4. 总长不超过 512 字节,只要超过 255 字节,名字就被整体替换为 2 个点号 ..,仍然不够则再截掉扩展名的尾部

      5. 总长不超过 512 字节,只要超过 255 字节,只会把名字的最后两个字符替换为 2 个点号 ..

      6. … (其它未被发现的规则,例如我还未测试仅含中文的场景)

Note

通过 pid,支持随意指定上传目标。特别是当格式为 f"U_{aid}_{pid}",允许其中的 aid != 1pid < 0 (可能有特殊指代)。 这里有一些特殊的位置:

  • U_0_{n}: 等同于 pid="U_1_0",无论 n 是什么值

  • U_1_-11: 上传附件到根目录下的 “记录文件”

  • U_3_-6: 上传附件到根目录下的 “消息文件”

  • U_3_-15: 上传封面到临时目录,等同于 pid="U_15_0"

  • U_3_-24: 上传文件到根目录下的 “手机备份”

  • U_3_{n}: n 可取 -1,-2,-3,-4,-5,-8,-9,-10,-12,-13,等同于 pid="U_120_0"

  • U_{a}_{n}: n 可取 0 或所有 aid=1 的文件或目录的 id,则上传目标为 aid=a, cid=n

Caution

如果最终的 aid 为 1 或 15,则剩余网盘空间会减掉上传文件的大小。 尽量不要使 aid=15,因为这会导致白白占掉空间,不能删除,也不能正常下载。

Parameters:
  • file – 待上传的文件

  • pid – 上传文件到此目录的 id 或 pickcode,或者指定的 target(格式为 f"U_{aid}_{pid}"f"S_{share_id}_{pid}"

  • share_id – 共享 id

  • filename – 文件名,如果为空,则会自动确定

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_image(file: Buffer | str | PathLike | SupportsRead | Iterable[Buffer], app: str = 'web', base_url: str | Callable[[], str] = 'https://credentials.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_image(file: Buffer | str | PathLike | SupportsRead | Iterable[Buffer] | AsyncIterable[Buffer], app: str = 'web', base_url: str | Callable[[], str] = 'https://credentials.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

上传一张图片,可用于作为证件照

POST https://credentials.115.com/api/1.0/{app}/1.0/credentials/upload_images

Attention

此接口采用 multi-part 上传,其实是可以一次传多个文件的,但我做的封装只允许传一张图片,最大允许传 10 MB

Parameters:
  • file – 待上传的文件

  • app – 使用此设备的接口

  • base_url – 接口的基地址

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_image_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_image_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

网页端的上传图片接口的初始化

POST https://uplb.115.com/3.0/imginitupload.php

Caution

此接口不支持秒传,最大支持上传 50 MB 的文件,上传成功后不占用空间

Caution

通过扩展名来识别,仅支持以下格式图片(jpg,jpeg,png,gif,svg,webp,heic,bmp,dng)

Note

target 随便设置,例如 "U_3_-1""U_4_-1""U_5_-2""U_3_-10"

Payload:
  • filename: str = <default> 💡 文件名,默认为一个新的 uuid4 对象的字符串表示

  • target: str = "U_4_-1" 💡 上传目标,格式为 f"U_{aid}_{pid}"

  • filesize: int | str = <default> 💡 图片大小

  • height: int = <default> 💡 图片高度

  • width: int = <default> 💡 图片宽度

upload_info(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_info(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取和上传有关的信息,其中 “user_id” 和 “userkey” 是至关重要的

GET https://webapi.115.com/files/uploadinfo

upload_info_app(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_info_app(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取和上传有关的信息,其中 “user_id” 和 “userkey” 是至关重要的

GET https://proapi.115.com/app/uploadinfo

upload_init(payload: dict, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_init(payload: dict, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

初始化上传任务,可能秒传

POST https://uplb.115.com/4.0/initupload.php

Caution

这个接口,偶尔会返回 HTTP 401 错误,你只需要再次重试即可

Payload:
  • fileid: str 💡 文件的 sha1

  • filename: str 💡 文件名

  • filesize: int 💡 文件大小

  • target: str = “U_1_0” 💡 保存目标,格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”

  • sign_key: str = “” 💡 2 次验证的 key

  • sign_val: str = “” 💡 2 次验证的值

  • topupload: int | str = “true” 💡 上传调度文件类型调度标记

  • userid: int | str = <default> 💡 用户 id

  • userkey: str = <default> 💡 用户的 key

upload_key(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_key(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 user_key

GET https://proapi.115.com/{app}/2.0/user/upload_key

upload_resume(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_resume(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取恢复断点续传所需信息

POST https://uplb.115.com/3.0/resumeupload.php

Payload:
  • fileid: str 💡 文件的 sha1 值

  • filesize: int 💡 文件大小,单位是字节

  • target: str 💡 上传目标,默认为 “U_1_0”,格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”

  • pickcode: str 💡 提取码

  • userid: int = <default> 💡 用户 id

upload_sample_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_sample_init(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://uplb.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

网页端的上传接口的初始化

POST https://uplb.115.com/3.0/sampleinitupload.php

Caution

此接口不支持秒传

Note

如果上传到自己的网盘,则 target 的格式是 “U_{aid}_{pid}”,如果上传到共享目录,格式为 “S_{share_id}_{pid}”

Payload:
  • filename: str = <default> 💡 文件名,默认为一个新的 uuid4 对象的字符串表示

  • target: str = “U_1_0” 💡 上传目标,格式为 f”U_{aid}_{pid}”(网盘)或 f”S_{share_id}_{pid}”(共享目录)

  • path: str = <default> 💡 保存目录,是在 target 对应目录下的相对路径,默认为 target 所对应目录本身

  • filesize: int | str = <default> 💡 文件大小

user_base_info(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_base_info(app: str = 'web', base_url: str | Callable[[], str] = 'https://qrcodeapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户的基本信息

GET https://qrcodeapi.115.com/app/1.0/{app}/1.0/user/base_info

user_card(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_card(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户信息

GET https://proapi.115.com/{app}/user/card

user_count_space_nums(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_count_space_nums(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取当前已用空间、可用空间、登录设备等信息

GET https://proapi.115.com/{app}/2.0/user/count_space_nums

user_display_uid_list(app: str = 'android', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_display_uid_list(app: str = 'android', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

账号信息 VIP 相关信息

GET https://passportapi.115.com/app/1.0/{app}/1.0/user/display_uid_list

user_fingerprint(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_fingerprint(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取截图时嵌入的水印

GET https://webapi.115.com/user/fingerprint

user_info(payload: None | int | str | dict = None, /, base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_info(payload: None | int | str | dict = None, /, base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户信息

GET https://my.115.com/proapi/3.0/index.php

Note

可以作为 staticmethod 使用,但必须指定查询参数 uid

Payload:
  • uid: int | str

  • method: str = “user_info” 💡 需要获取的数据类别

    • “user_info”: 用户信息

    • “get_interests_list”: 兴趣列表

    • “get_jobs_list”: 工作列表

    • “get_privacy_settings”: 隐私资料

    • “get_public”: 公开资料

    • “check_secret_token”: 隐私令牌

user_info2(payload: int | str | dict = '', /, app: str = 'web', base_url: str | Callable[[], str] = 'https://home.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_info2(payload: int | str | dict = '', /, app: str = 'web', base_url: str | Callable[[], str] = 'https://home.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户信息

GET https://home.115.com/api/1.0/{app}/1.0/user/user_info

Payload:
  • uid: int | str

user_info3(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_info3(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户信息

GET https://my.115.com/?ct=ajax&ac=nav

user_info4(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_info4(base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户信息

GET https://webapi.115.com/user/info

user_info_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_info_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

更新用户信息

POST https://my.115.com/proapi/3.0/index.php?method=set_user

Payload:
  • user_name: str = <default> 💡 网名(1-15 个中英文字符,15天允许修改一次网名)

  • gender: -1 | 0 | 1 = <default> 💡 性别。-1:未知 0:女 1:男

  • calendar_type: 0 | 1 = <default> 💡 日历类型。0:公历 1:农历

  • birthday: str = <default> 💡 生日,格式为 年-月-日(不需要补前 0,初始值为 0-0-0)

  • height: int = <default> 💡 身高

  • weight: int = <default> 💡 体重

  • blood_type: “A” | “B” | “C” | “D” | “O” = <default> 💡 血型。A:A型 B:B型 C:AB型 O:O型 D:其它

  • is_marry: int = <default> 💡 感情

    • 0: 保密

    • 1: 单身

    • 2: 恋爱中

    • 3: 已婚

    • 4: 分居

    • 5: 离异

    • 9: 请选择

  • education: int = <default> 💡 学历

    • -1: 选择学历

    • 0: 初中

    • 1: 高中

    • 2: 中专

    • 3: 大专

    • 4: 本科

    • 5: 硕士

    • 6: 博士及以上

  • job: int = <default> 💡 职业

    • -1: 选择职业

    • 1: 计算机/互联网/通信

    • 2: 生产/工艺/制造

    • 3: 医疗/护理/制药

    • 4: 金融/银行/投资/保险

    • 5: 商业/服务业/个体经营

    • 6: 文化/广告/传媒

    • 7: 娱乐/艺术/表演

    • 8: 律师/法务

    • 9: 教育/培训

    • 10: 公务员/行政/事业单位

    • 11: 模特

    • 12: 空姐

    • 13: 学生

    • 14: 其他职业

  • salary: str = <default> 💡 收入

    • “”

    • “2千-3千”

    • “3千-4.5千”

    • “4.5千-6千”

    • “7千-8千”

    • “8千-1万”

    • “1万以下”

    • “1万-2万”

    • “2万-3万”

    • “3万-4万”

    • “4万-5万”

    • “5万以上”

  • location_birth: int = <default> 💡 家乡。填 115 给出的地区编码,初始值为 0

  • location: int = <default> 💡 现居地。填 115 给出的地区编码,初始值为 0

  • location_link: int = <default> 💡 快递地址。填 115 给出的地区编码,初始值为 0

  • address: str = <default> 💡 输入详细街道地址

  • wechat: str = <default> 💡 微信

  • weibo: str = <default> 💡 微博

  • alipay: str = <default> 💡 支付宝

  • pub_mobile: str = <default> 💡 电话

  • pub_email: str = <default> 💡 邮箱

  • homepage: str = <default> 💡 个人网站

  • like_celeb: str = <default> 💡 最喜欢的名人

  • like_music: str = <default> 💡 最喜欢的音乐

  • like_animal: str = <default> 💡 最喜欢的动物

  • like_book: str = <default> 💡 最喜欢的书籍

  • like_video: str = <default> 💡 最喜欢的视频

  • interest: str = <default> 💡 兴趣爱好

user_interests_list(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_interests_list(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

用户兴趣列表

GET https://my.115.com/proapi/3.0/index.php?method=get_interests_list

user_my(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_my(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取此用户信息

GET https://my.115.com/?ct=ajax&ac=

user_my_info(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_my_info(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取此用户信息(更全)

GET https://my.115.com/?ct=ajax&ac=get_user_aq

user_points_balance(app: str = 'web', base_url: str | Callable[[], str] = 'https://points.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_points_balance(app: str = 'web', base_url: str | Callable[[], str] = 'https://points.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

剩余的签到积分

GET https://points.115.com/api/1.0/{app}/1.0/user/balance

user_points_sign(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_points_sign(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取签到信息

GET https://proapi.115.com/{app}/2.0/user/points_sign

user_points_sign_post(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_points_sign_post(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

每日签到(注意:不要用 web,即浏览器,的 cookies,会失败)

POST https://proapi.115.com/{app}/2.0/user/points_sign

user_points_transaction(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://points.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_points_transaction(payload: int | dict = 0, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://points.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

签到记录

GET https://points.115.com/api/1.0/{app}/1.0/user/transaction

payload:
  • start: int = 0

  • limit: int = 32

  • month: str = <default> 💡 月份,格式为 YYYYMM

user_public(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_public(base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

用户隐私设置

GET https://my.115.com/proapi/3.0/index.php?method=get_public

user_public_set(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_public_set(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://my.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置用户隐私

POST https://my.115.com/proapi/3.0/index.php?method=set_public

Payload:
  • column: str 💡 隐私项

  • open: 0 | 1 = 1 💡 是否公开可见

user_relation_info(app: str = 'web', base_url: str | Callable[[], str] = 'https://home.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_relation_info(app: str = 'web', base_url: str | Callable[[], str] = 'https://home.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户的关系信息

GET https://home.115.com/api/1.0/{app}/1.0/my_star/relation_info

user_security_key_check(payload: int | str | dict = '', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_security_key_check(payload: int | str | dict = '', /, app: str = 'android', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取安全密钥对应的 token,可以提供给某些接口,作为通过安全密钥验证的凭证

POST https://passportapi.115.com/app/1.0/{app}/1.0/user/security_key_check

Payload:
  • passwd: int | str = “000000” 💡 安全密钥,值为实际安全密钥的 md5 哈希值

user_setting(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取此账户的设置

GET https://115.com/?ac=setting&even=saveedit&is_wl_tpl=1

user_setting2(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting2(base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取此账户的设置

GET https://115.com/?ct=user_setting&ac=get

user_setting_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting_app(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取此账户的 app 版设置(提示:较为复杂,自己抓包研究)

GET https://proapi.115.com/{app}/1.0/user/setting

user_setting_app_set(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting_app_set(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取(并可修改)此账户的网页版设置(提示:较为复杂,自己抓包研究)

POST https://proapi.115.com/{app}/1.0/user/setting

user_setting_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改此账户的网页版设置(提示:较为复杂,自己抓包研究)

POST https://115.com/?ac=setting&even=saveedit&is_wl_tpl=1

user_setting_web(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting_web(payload: dict = {}, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取此账户的 app 版设置(提示:较为复杂,自己抓包研究)

GET https://webapi.115.com/user/setting

Payload:
  • keys: str 💡 查询的设置参数,多个用逗号 “,” 隔开

user_setting_web_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_setting_web_set(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取(并可修改)此账户的网页版设置(提示:较为复杂,自己抓包研究)

POST https://webapi.115.com/user/setting

user_sign(base_url: str | Callable[[], str] = 'https://q.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_sign(base_url: str | Callable[[], str] = 'https://q.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

个性签名

GET https://q.115.com/home/setting/sign

user_sign_set(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://q.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_sign_set(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://q.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

修改个性签名

POST https://q.115.com/ajax_users/save_sign

Payload:
  • content: str 💡 个性签名,支持 HTML

user_space_info(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_space_info(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取使用空间的统计数据(较为简略,如需更详细,请用 P115Client.fs_index_info()

GET https://proapi.115.com/{app}/user/space_info

user_teen_mode_state(app: str = 'web', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_teen_mode_state(app: str = 'web', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取青少年(未成年)模式状态

GET https://passportapi.115.com/app/1.0/{app}/1.0/user/teen_mode_state

user_teen_mode_state_set(payload: bool | dict = True, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_teen_mode_state_set(payload: bool | dict = True, /, app: str = 'web', base_url: str | Callable[[], str] = 'https://passportapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

开关青少年(未成年)模式状态

POST https://passportapi.115.com/app/1.0/{app}/1.0/user/teen_mode_set_state

Payload:
  • state: 0 | 1 💡 是否开启

  • passwd: str = “0000” 💡 密码(4 位数字),需要经过 md5 签名处理,md5(f”{passwd}{user_id}62454aa2c6fd4”.encode(“ascii”)).hexdigest()

user_vip_check_spw(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_vip_check_spw(app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户积分、余额等信息

GET https://proapi.115.com/{app}/vip/check_spw

user_vip_limit(payload: int | dict = 2, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_vip_limit(payload: int | dict = 2, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取 vip 的某些限制

GET https://webapi.115.com/user/vip_limit

Payload:
  • feature: int = 2

usershare_action(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_action(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享动态列表

GET https://webapi.115.com/usershare/action

Payload:
  • share_id: int | str

  • offset: int = 0

  • limit: int = 32

usershare_action_app(payload: int | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_action_app(payload: int | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享动态列表

GET https://proapi.115.com/{app}/2.0/usershare/action

Payload:
  • share_id: int | str

  • offset: int = 0

  • limit: int = 32

usershare_add_folder(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_add_folder(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

转存共享文件或目录

POST https://webapi.115.com/usershare/add_folder

Payload:
  • share_id: int | str

  • pid: int | str

  • cname: str

usershare_add_folder_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_add_folder_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

转存共享文件或目录

POST https://proapi.115.com/{app}/2.0/usershare/add_folder

Payload:
  • share_id: int | str

  • pid: int | str

  • cname: str

usershare_copy(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_copy(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

转存文件或目录

POST https://webapi.115.com/usershare/copy

Payload:
  • share_id: int | str

  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • to_cid: int = 0 💡 转存到你的网盘中的目录 id

  • copy_type: 0 | 1 = 0 💡 复制类型:0:共享->网盘 1:网盘->共享

usershare_copy_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_copy_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

转存文件或目录

POST https://proapi.115.com/{app}/2.0/usershare/copy

Payload:
  • share_id: int | str

  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • to_cid: int = 0 💡 转存到你的网盘中的目录 id

  • copy_type: 0 | 1 = 0 💡 复制类型:0:共享->网盘 1:网盘->共享

usershare_delete(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_delete(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除共享文件或目录

POST https://webapi.115.com/usershare/delete

Payload:
  • share_id: int | str

  • file_ids: int | str 💡 共享中的文件或目录的 id,多个用逗号 “,” 隔开

  • ignore_warn: 0 | 1 = 0

usershare_delete_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_delete_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除共享文件或目录

POST https://proapi.115.com/{app}/2.0/usershare/delete

Payload:
  • share_id: int | str

  • file_ids: int | str 💡 共享中的文件或目录的 id,多个用逗号 “,” 隔开

  • ignore_warn: 0 | 1 = 0

usershare_download_url(pickcode: str, /, share_id: int | str, strict: bool = True, user_agent: None | str = None, app: str = 'chrome', *, async_: Literal[False] = False, **request_kwargs) P115URL[source]
usershare_download_url(pickcode: str, /, share_id: int | str, strict: bool = True, user_agent: None | str = None, app: str = 'chrome', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115URL]

获取共享文件的下载链接

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcode – 提取码

  • share_id – 共享 id

  • strict – 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • app – 使用此设备的接口

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

usershare_download_url_web(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_download_url_web(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件的下载链接(网页版接口)

POST https://webapi.115.com/usershare/download

Note

下载的文件大小没有 200 MB 的限制

Payload:
  • share_id: int | str

  • pick_code: str

  • dl: int = 0

usershare_download_urls(pickcodes: str | Iterable[str], /, share_id: int | str, strict: bool = True, user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[int, P115URL][source]
usershare_download_urls(pickcodes: str | Iterable[str], /, share_id: int | str, strict: bool = True, user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict[int, P115URL]]

批量获取共享文件的下载链接

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcodes – 提取码,多个用逗号 “,” 隔开

  • share_id – 共享 id

  • strict – 如果为 True,当目标是目录时,会直接忽略

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

一批下载链接

usershare_file_list(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_file_list(payload: dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

共享目录中的文件列表

GET https://webapi.115.com/usershare/filelist

Payload:
  • share_id: int | str

  • cid: int | str 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,目前最大值是 1,150,以前是没限制的

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数,好像也可以写成 countfolders

  • cur: 0 | 1 = <default> 💡 是否只搜索当前目录

  • custom_order: 0 | 1 = <default> 💡 启用自定义排序,如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 1

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • show_dir: 0 | 1 = 1 💡 是否显示目录,好像也可以写成 showdir

  • star: 0 | 1 = <default> 💡 是否星标文件

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • suffix_type: int = <default>

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: ???,文档

    • 15: 图片+视频,相当于 2、4

    • 16: 字幕

    • 17~98: 大概相当于 1

    • 99: 所有文件

    • >=100: 大概相当于 1

usershare_file_list_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_file_list_app(payload: dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

共享目录中的文件列表

GET https://proapi.115.com/{app}/2.0/usershare/filelist

Payload:
  • share_id: int | str

  • cid: int | str 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,目前最大值是 1,150,以前是没限制的

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数,好像也可以写成 countfolders

  • cur: 0 | 1 = <default> 💡 是否只搜索当前目录

  • custom_order: 0 | 1 = <default> 💡 启用自定义排序,如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 1

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • show_dir: 0 | 1 = 1 💡 是否显示目录,好像也可以写成 showdir

  • star: 0 | 1 = <default> 💡 是否星标文件

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • suffix_type: int = <default>

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8-11: 大概相当于 1

    • 12: 文档+图片+视频,相当于 1、2、4

    • 13: ???,音频

    • 14: 大概相当于 1

    • 15: 图片+视频,相当于 2、4

    • >= 16: 相当于 8

usershare_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享信息

GET https://webapi.115.com/usershare/shareinfo

Payload:
  • share_id: int | str

usershare_info_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_info_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享信息

GET https://proapi.115.com/{app}/2.0/usershare/shareinfo

Payload:
  • share_id: int | str

usershare_invite(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_invite(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享链接

POST https://webapi.115.com/usershare/invite

Payload:
  • share_id: int | str

usershare_invite_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_invite_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取共享链接

POST https://proapi.115.com/{app}/2.0/usershare/invite

Payload:
  • share_id: int | str

usershare_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_list(payload: int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

共享列表

GET https://webapi.115.com/usershare/list

Payload:
  • offset: int = 0

  • limit: int = 1150

  • type: “all” | “others” | “mine” = “all” 💡 类型:all:全部共享 others:他人共享 mine:我共享的

usershare_list_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_list_app(payload: int | str | dict = 0, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

共享列表

GET https://proapi.115.com/{app}/2.0/usershare/list

Payload:
  • offset: int = 0

  • limit: int = 1150

  • type: “all” | “others” | “mine” = “all” 💡 类型:all:全部共享 others:他人共享 mine:我共享的

usershare_member(payload: int | dict, /, method: str = 'POST', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_member(payload: int | dict, /, method: str = 'POST', base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

某共享的成员信息

POST https://webapi.115.com/usershare/member

Payload:
  • share_id: int | str

  • action: str = “member_list”

    • “member_list”: 用户列表

    • “member_info”: 用户信息

    • “noticeset”: 设置通知

    • “priviset”: 设置权限(共享拥有者用于对待他人)

    • “remove”: 移除成员

    • “join”: 加入邀请

    • “quit”: 退出共享

  • notice_set: 0 | 1 = <default> 💡 是否开启通知,action 为 “noticeset” 时设置

  • privi_set[{user_id}]: int | str = <default> 💡 设置权限,action 为 “priviset” 时设置,多个用逗号 “,” 隔开

    • 2: 上传

    • 8: 转存/下载

  • member_uid: int | str = <default> 💡 用户 id,action 为 “remove” 时设置

  • delete_file: 0 | 1 = <default> 💡 是否同时删除他共享的文件,action 为 “remove” 或 “quit” 时设置

  • invite_code: str = <default> 💡 分享码,action 为 “join” 时设置

usershare_member_app(payload: int | dict, /, method: str = 'POST', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_member_app(payload: int | dict, /, method: str = 'POST', app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

某共享的成员信息

POST https://proapi.115.com/{app}/2.0/usershare/member

Payload:
  • share_id: int | str

  • action: str = “member_list”

    • “member_list”: 用户列表

    • “member_info”: 用户信息

    • “noticeset”: 设置通知

    • “priviset”: 设置权限(共享拥有者用于对待他人)

    • “remove”: 移除成员

    • “join”: 加入邀请

    • “quit”: 退出共享

  • notice_set: 0 | 1 = <default> 💡 是否开启通知,action 为 “noticeset” 时设置

  • privi_set[{user_id}]: int | str = <default> 💡 设置权限,action 为 “priviset” 时设置,多个用逗号 “,” 隔开

    • 2: 上传

    • 8: 转存/下载

  • member_uid: int | str = <default> 💡 用户 id,action 为 “remove” 时设置

  • delete_file: 0 | 1 = <default> 💡 是否同时删除他共享的文件,action 为 “remove” 或 “quit” 时设置

  • invite_code: str = <default> 💡 分享码,action 为 “join” 时设置

usershare_share(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_share(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://webapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置共享

POST https://webapi.115.com/usershare/share

Payload:
  • file_id: int | str 💡 文件或目录的 id

  • share_opt: 1 | 2 = 1 💡 1: 设置 2: 取消

  • ignore_warn: 0 | 1 = 0

  • safe_pwd: str = “”

usershare_share_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
usershare_share_app(payload: int | str | dict, /, app: str = 'android', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置共享

POST https://proapi.115.com/{app}/2.0/usershare/share

Payload:
  • file_id: int | str 💡 文件或目录的 id

  • share_opt: 1 | 2 = 1 💡 1: 设置 2: 取消

  • ignore_warn: 0 | 1 = 0

  • safe_pwd: str = “”

class p115client.client.P115OpenClient(access_token: str = '', refresh_token: str = '', app_id: int = 0, console_qrcode: bool = True)[source]

Bases: ClientRequestMixin

115 的客户端对象

Parameters:
  • access_token – 访问令牌

  • refresh_token – 刷新令牌

  • app_id – 授权的 open 应用的 AppID

  • console_qrcode – 需要扫码登录时,是否在命令行输出二维码

clouddownload_quota_info(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_quota_info(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取云下载配额信息

GET https://proapi.115.com/open/offline/get_quota_info

clouddownload_quota_info_open(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取云下载配额信息

GET https://proapi.115.com/open/offline/get_quota_info

clouddownload_task_add_bt(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_add_bt(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加云下载 BT 任务

POST https://proapi.115.com/open/offline/add_task_bt

Payload:
  • info_hash: str 💡 种子文件的 info_hash

  • pick_code: str 💡 种子文件的提取码

  • save_path: str 💡 保存到 wp_path_id 对应目录下的相对路径

  • torrent_sha1: str 💡 种子文件的 sha1

  • wanted: str 💡 选择文件进行下载(是数字索引,从 0 开始计数,用 “,” 分隔)

  • wp_path_id: int | str = <default> 💡 保存目标目录 id

clouddownload_task_add_bt_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

添加云下载 BT 任务

POST https://proapi.115.com/open/offline/add_task_bt

Payload:
  • info_hash: str 💡 种子文件的 info_hash

  • pick_code: str 💡 种子文件的提取码

  • save_path: str 💡 保存到 wp_path_id 对应目录下的相对路径

  • torrent_sha1: str 💡 种子文件的 sha1

  • wanted: str 💡 选择文件进行下载(是数字索引,从 0 开始计数,用 “,” 分隔)

  • wp_path_id: int | str = <default> 💡 保存目标目录 id

clouddownload_task_add_urls(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_add_urls(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

添加云下载链接任务

POST https://proapi.115.com/open/offline/add_task_urls

Payload:
  • urls: str 💡 链接,用 “n” 分隔,支持HTTP、HTTPS、FTP、磁力链和电驴链接

  • wp_path_id: int | str = <default> 💡 保存到目录的 id

clouddownload_task_add_urls_open(payload: str | Iterable[str] | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

添加云下载链接任务

POST https://proapi.115.com/open/offline/add_task_urls

Payload:
  • urls: str 💡 链接,用 “n” 分隔,支持HTTP、HTTPS、FTP、磁力链和电驴链接

  • wp_path_id: int | str = <default> 💡 保存到目录的 id

clouddownload_task_clear(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_clear(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

清空云下载任务

POST https://proapi.115.com/open/offline/clear_task

Payload:
  • flag: int = 0 💡 标识,用于对应某种情况

    • 0: 已完成

    • 1: 全部

    • 2: 已失败

    • 3: 进行中

    • 4: 已完成+删除源文件

    • 5: 全部+删除源文件

clouddownload_task_clear_open(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

清空云下载任务

POST https://proapi.115.com/open/offline/clear_task

Payload:
  • flag: int = 0 💡 标识,用于对应某种情况

    • 0: 已完成

    • 1: 全部

    • 2: 已失败

    • 3: 进行中

    • 4: 已完成+删除源文件

    • 5: 全部+删除源文件

clouddownload_task_del(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_del(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除云下载任务

POST https://proapi.115.com/open/offline/del_task

Payload:
  • info_hash: str 💡 待删除任务的 info_hash

  • del_source_file: 0 | 1 = <default> 💡 是否删除源文件 1:删除 0:不删除

clouddownload_task_del_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

删除云下载任务

POST https://proapi.115.com/open/offline/del_task

Payload:
  • info_hash: str 💡 待删除任务的 info_hash

  • del_source_file: 0 | 1 = <default> 💡 是否删除源文件 1:删除 0:不删除

clouddownload_task_list(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_task_list(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取云下载任务列表

GET https://proapi.115.com/open/offline/get_task_list

Payload:
  • page: int = 1

clouddownload_task_list_open(payload: int | dict = 1, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取云下载任务列表

GET https://proapi.115.com/open/offline/get_task_list

Payload:
  • page: int = 1

clouddownload_torrent(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
clouddownload_torrent(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

解析 BT 种子

POST https://proapi.115.com/open/offline/torrent

Payload:
  • torrent_sha1: str 💡 种子文件的 sha1

  • pick_code: str 💡 种子文件的提取码

clouddownload_torrent_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

解析 BT 种子

POST https://proapi.115.com/open/offline/torrent

Payload:
  • torrent_sha1: str 💡 种子文件的 sha1

  • pick_code: str 💡 种子文件的提取码

download_url(pickcode: int | str, /, strict: bool = True, user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) P115URL[source]
download_url(pickcode: int | str, /, strict: bool = True, user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, P115URL]

获取文件的下载链接,此接口是对 download_url_info 的封装

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcode – id 或者提取码

  • strict – 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

download_url_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[source]
download_url_info(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件的下载链接

POST https://proapi.115.com/open/ufile/downurl

Hint

相当于 P115Client.download_url_app(app=”chrome”)

Payload:
  • pick_code: str 💡 提取码,多个用逗号 “,” 隔开

download_url_info_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', user_agent: None | str = None, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取文件的下载链接

POST https://proapi.115.com/open/ufile/downurl

Hint

相当于 P115Client.download_url_app(app=”chrome”)

Payload:
  • pick_code: str 💡 提取码,多个用逗号 “,” 隔开

download_url_open(pickcode: int | str, /, strict: bool = True, user_agent: None | str = None, *, async_: Literal[False, True] = False, **request_kwargs) P115URL | Coroutine[Any, Any, P115URL]

获取文件的下载链接,此接口是对 download_url_info 的封装

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcode – id 或者提取码

  • strict – 如果为 True,当目标是目录时,会抛出 IsADirectoryError 异常

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

下载链接

download_urls(pickcodes: int | str | Iterable[int | str], /, strict: bool = True, user_agent: None | str = None, *, async_: Literal[False] = False, **request_kwargs) dict[int, P115URL][source]
download_urls(pickcodes: int | str | Iterable[int | str], /, strict: bool = True, user_agent: None | str = None, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict[int, P115URL]]

批量获取文件的下载链接,此接口是对 download_url_info 的封装

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcodes – 提取码,多个用逗号 “,” 隔开

  • strict – 如果为 True,当目标是目录时,会直接忽略

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

一批下载链接

download_urls_open(pickcodes: int | str | Iterable[int | str], /, strict: bool = True, user_agent: None | str = None, *, async_: Literal[False, True] = False, **request_kwargs) dict[int, P115URL] | Coroutine[Any, Any, dict[int, P115URL]]

批量获取文件的下载链接,此接口是对 download_url_info 的封装

Note

获取的直链中,部分查询参数的解释:

  • t: 过期时间戳

  • u: 用户 id

  • c: 允许同时打开次数,如果为 0,则是无限次数

  • f: 请求时要求携带请求头
    • 如果为空,则无要求

    • 如果为 1,则需要 user-agent(和请求直链时的一致)

    • 如果为 3,则需要 user-agent(和请求直链时的一致) 和 Cookie(由请求直链时的响应所返回的 Set-Cookie 响应头)

Parameters:
  • pickcodes – 提取码,多个用逗号 “,” 隔开

  • strict – 如果为 True,当目标是目录时,会直接忽略

  • user_agent – 如果不为 None,则作为请求头 “user-agent” 的值

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

一批下载链接

fs_copy(payload: int | str | Iterable[int | str] | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_copy(payload: int | str | Iterable[int | str] | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

文件复制

POST https://proapi.115.com/open/ufile/copy

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • file_id: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • pid: int | str = 0 💡 父目录 id

  • nodupli: 0 | 1 = 0 💡 复制的文件在目标目录是否允许重复:0:可以 1:不可以

fs_copy_open(payload: int | str | Iterable[int | str] | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

文件复制

POST https://proapi.115.com/open/ufile/copy

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • file_id: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • pid: int | str = 0 💡 父目录 id

  • nodupli: 0 | 1 = 0 💡 复制的文件在目标目录是否允许重复:0:可以 1:不可以

fs_delete(payload: int | str | dict | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_delete(payload: int | str | dict | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

删除文件或目录

POST https://proapi.115.com/open/ufile/delete

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

fs_delete_open(payload: int | str | dict | Iterable[int | str], /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

删除文件或目录

POST https://proapi.115.com/open/ufile/delete

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

fs_files(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_files(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息

GET https://proapi.115.com/open/ufile/files

Hint

相当于 P115Client.fs_files_app()

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,最大值不一定,看数据量,7,000 应该总是安全的,10,000 有可能报错,但有时也可以 20,000 而成功

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数

  • cur: 0 | 1 = <default> 💡 是否只显示当前目录

  • custom_order: 0 | 1 | 2 = <default> 💡 是否使用记忆排序。如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 2

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • fields: str = <default>

  • for: str = <default> 💡 文件格式,例如 “doc”

  • is_q: 0 | 1 = <default>

  • is_share: 0 | 1 = <default>

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_etime”: 事件时间(无效,效果相当于 “user_utime”)

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间(无效,效果相当于 “user_utime”)

    • “user_otime”: 上一次打开时间(无效,效果相当于 “user_utime”)

  • qid: int = <default>

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8: 其它

    • 9: 相当于 8

    • 10: 相当于 8

    • 11: 相当于 8

    • 12: ???

    • 13: ???

    • 14: ???

    • 15: 图片和视频,相当于 2 和 4

    • >= 16: 相当于 8

fs_files_open(payload: None | int | str | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取目录中的文件列表和基本信息

GET https://proapi.115.com/open/ufile/files

Hint

相当于 P115Client.fs_files_app()

Payload:
  • cid: int | str = 0 💡 目录 id,对应 parent_id

  • limit: int = 32 💡 分页大小,最大值不一定,看数据量,7,000 应该总是安全的,10,000 有可能报错,但有时也可以 20,000 而成功

  • offset: int = 0 💡 分页开始的索引,索引从 0 开始计算

  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列。0:降序 1:升序

  • count_folders: 0 | 1 = 1 💡 统计文件数和目录数

  • cur: 0 | 1 = <default> 💡 是否只显示当前目录

  • custom_order: 0 | 1 | 2 = <default> 💡 是否使用记忆排序。如果指定了 “asc”、”fc_mix”、”o” 中其一,则此参数会被自动设置为 2

    • 0: 使用记忆排序(自定义排序失效)

    • 1: 使用自定义排序(不使用记忆排序)

    • 2: 自定义排序(非目录置顶)

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • fields: str = <default>

  • for: str = <default> 💡 文件格式,例如 “doc”

  • is_q: 0 | 1 = <default>

  • is_share: 0 | 1 = <default>

  • min_size: int = 0 💡 最小的文件大小

  • max_size: int = 0 💡 最大的文件大小(含),<= 0 表示不限,因此并不能借此仅筛选出空文件

  • natsort: 0 | 1 = <default> 💡 是否执行自然排序(natural sorting)

  • nf: 0 | 1 = <default> 💡 不要显示文件(即仅显示目录),但如果 show_dir=0,则此参数无效

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_etime”: 事件时间(无效,效果相当于 “user_utime”)

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间(无效,效果相当于 “user_utime”)

    • “user_otime”: 上一次打开时间(无效,效果相当于 “user_utime”)

  • qid: int = <default>

  • r_all: 0 | 1 = <default>

  • record_open_time: 0 | 1 = 1 💡 是否要记录目录的打开时间

  • scid: int | str = <default>

  • show_dir: 0 | 1 = 1 💡 是否显示目录

  • snap: 0 | 1 = <default>

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • stdir: 0 | 1 = <default> 💡 筛选文件时,是否显示目录:1:展示 0:不展示

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 8: 其它

    • 9: 相当于 8

    • 10: 相当于 8

    • 11: 相当于 8

    • 12: ???

    • 13: ???

    • 14: ???

    • 15: 图片和视频,相当于 2 和 4

    • >= 16: 相当于 8

fs_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', method: str = 'GET', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_info(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', method: str = 'GET', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取文件或目录详情

GET https://proapi.115.com/open/folder/get_info

Note

支持 GET 和 POST 方法。file_idpath 需必传一个

Hint

具有 P115Client.fs_category_get() 的能力,而且更强,因为支持用 path 查询

Caution

尝试获取目录的信息时,会去计算目录中文件和目录的数量、总文件大小 等信息,可能会消耗大量时间,但短时间内再次查询同一目录,耗时可能会大大减小

Payload:
  • file_id: int | str 💡 文件或目录的 id

  • path: str = <default> 💡 文件或目录的路径。分隔符支持 / 和 > 两种符号,最前面需分隔符开头,以分隔符分隔目录层级

fs_info_open(payload: int | str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', method: str = 'GET', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取文件或目录详情

GET https://proapi.115.com/open/folder/get_info

Note

支持 GET 和 POST 方法。file_idpath 需必传一个

Hint

具有 P115Client.fs_category_get() 的能力,而且更强,因为支持用 path 查询

Caution

尝试获取目录的信息时,会去计算目录中文件和目录的数量、总文件大小 等信息,可能会消耗大量时间,但短时间内再次查询同一目录,耗时可能会大大减小

Payload:
  • file_id: int | str 💡 文件或目录的 id

  • path: str = <default> 💡 文件或目录的路径。分隔符支持 / 和 > 两种符号,最前面需分隔符开头,以分隔符分隔目录层级

fs_mkdir(payload: str | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_mkdir(payload: str | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

新建目录

POST https://proapi.115.com/open/folder/add

Payload:
  • file_name: str 💡 新建目录名称,限制 255 个字符

  • pid: int | str = 0 💡 新建目录所在的父目录ID (根目录的ID为0)

fs_mkdir_open(payload: str | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

新建目录

POST https://proapi.115.com/open/folder/add

Payload:
  • file_name: str 💡 新建目录名称,限制 255 个字符

  • pid: int | str = 0 💡 新建目录所在的父目录ID (根目录的ID为0)

fs_move(payload: int | str | Iterable[int | str] | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_move(payload: int | str | Iterable[int | str] | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

文件移动

POST https://proapi.115.com/open/ufile/move

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • to_cid: int | str = 0 💡 父目录 id

fs_move_open(payload: int | str | Iterable[int | str] | dict, /, pid: int | str = 0, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

文件移动

POST https://proapi.115.com/open/ufile/move

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • file_ids: int | str 💡 文件或目录的 id,多个用逗号 “,” 隔开

  • to_cid: int | str = 0 💡 父目录 id

fs_rename(payload: tuple[int | str, str] | dict, /, *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_rename(payload: tuple[int | str, str] | dict, /, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

重命名文件或目录,此接口是对 fs_update_open 的封装

Caution

改名时,虽然不能修改扩展名,但是一定要带上扩展名(无论是啥),不然会把最后一个句点 . 及其之后文字截断

Payload:
  • file_id: int | str 💡 文件 id

  • file_name: str 💡 文件名

fs_rename_open(payload: tuple[int | str, str] | dict, /, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

重命名文件或目录,此接口是对 fs_update_open 的封装

Caution

改名时,虽然不能修改扩展名,但是一定要带上扩展名(无论是啥),不然会把最后一个句点 . 及其之后文字截断

Payload:
  • file_id: int | str 💡 文件 id

  • file_name: str 💡 文件名

fs_search(payload: str | dict = '.', /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

搜索文件或目录

GET https://proapi.115.com/open/ufile/search

Attention

最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000,不过可以一次性取完

不过就算正确设置了 limitoffset,并且总数据量大于 limit + offset,可能也不足 limit,这应该是 bug,也就是说,就算数据总量足够你也取不到足量

它返回数据中的 count 字段的值表示总数据量(即使你只能取前 10,000 条),往往并不准确,最多能当作一个可参考的估计值

Note

这个方法似乎不支持仅搜索目录本身,搜索范围是从指定目录开始的整个目录树

Hint

相当于 P115Client.fs_search_app2()

Payload:
  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cid: int | str = 0 💡 目录 id。cid=-1 时,表示不返回列表任何内容

  • count_folders: 0 | 1 = <default>

  • date: str = <default> 💡 筛选日期

  • fc: 0 | 1 = <default> 💡 只显示文件或目录。1:只显示目录 2:只显示文件

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • file_label: int | str = <default> 💡 标签 id

  • gte_day: str 💡 搜索结果匹配的开始时间;格式:YYYY-MM-DD

  • limit: int = 32 💡 一页大小,意思就是 page_size

  • lte_day: str 💡 搜索结果匹配的结束时间;格式:YYYY-MM-DD

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • search_value: str = “.” 💡 搜索文本,可以是 sha1

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 99: 所有文件

  • version: str = <default> 💡 版本号,比如 3.1

fs_search_open(payload: str | dict = '.', /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

搜索文件或目录

GET https://proapi.115.com/open/ufile/search

Attention

最多只能取回前 10,000 条数据,也就是 limit + offset <= 10_000,不过可以一次性取完

不过就算正确设置了 limitoffset,并且总数据量大于 limit + offset,可能也不足 limit,这应该是 bug,也就是说,就算数据总量足够你也取不到足量

它返回数据中的 count 字段的值表示总数据量(即使你只能取前 10,000 条),往往并不准确,最多能当作一个可参考的估计值

Note

这个方法似乎不支持仅搜索目录本身,搜索范围是从指定目录开始的整个目录树

Hint

相当于 P115Client.fs_search_app2()

Payload:
  • aid: int = 1 💡 area_id

    • 0: 会被视为 1

    • 1: 正常文件

    • 2: <unknown>

    • 3: <unknown>

    • 4: <unknown>

    • 5: <unknown>

    • 7: 回收站文件

    • 9: <unknown>

    • 12: 瞬间文件

    • 15: <unknown>

    • 120: 彻底删除文件、简历附件

    • <其它>: 会被视为 0

  • asc: 0 | 1 = <default> 💡 是否升序排列

  • cid: int | str = 0 💡 目录 id。cid=-1 时,表示不返回列表任何内容

  • count_folders: 0 | 1 = <default>

  • date: str = <default> 💡 筛选日期

  • fc: 0 | 1 = <default> 💡 只显示文件或目录。1:只显示目录 2:只显示文件

  • fc_mix: 0 | 1 = <default> 💡 是否目录和文件混合,如果为 0 则目录在前(目录置顶)

  • file_label: int | str = <default> 💡 标签 id

  • gte_day: str 💡 搜索结果匹配的开始时间;格式:YYYY-MM-DD

  • limit: int = 32 💡 一页大小,意思就是 page_size

  • lte_day: str 💡 搜索结果匹配的结束时间;格式:YYYY-MM-DD

  • o: str = <default> 💡 用某字段排序

    • “file_name”: 文件名

    • “file_size”: 文件大小

    • “file_type”: 文件种类

    • “user_utime”: 修改时间

    • “user_ptime”: 创建时间

    • “user_otime”: 上一次打开时间

  • offset: int = 0 💡 索引偏移,索引从 0 开始计算

  • search_value: str = “.” 💡 搜索文本,可以是 sha1

  • source: str = <default>

  • star: 0 | 1 = <default> 💡 是否星标文件

  • suffix: str = <default> 💡 后缀名(优先级高于 type

  • type: int = <default> 💡 文件类型

    • 0: 全部(仅当前目录)

    • 1: 文档

    • 2: 图片

    • 3: 音频

    • 4: 视频

    • 5: 压缩包

    • 6: 软件/应用

    • 7: 书籍

    • 99: 所有文件

  • version: str = <default> 💡 版本号,比如 3.1

fs_star_set(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_star_set(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

为文件或目录设置或取消星标,此接口是对 fs_update_open 的封装

Note

即使其中任何一个 id 目前已经被删除,也可以操作成功

Payload:
  • file_id: int | str 💡 只能传入 1 个

  • file_id[0]: int | str 💡 如果有多个,则按顺序给出

  • file_id[1]: int | str

  • star: 0 | 1 = 1

fs_star_set_open(payload: int | str | Iterable[int | str] | dict, /, star: bool = True, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

为文件或目录设置或取消星标,此接口是对 fs_update_open 的封装

Note

即使其中任何一个 id 目前已经被删除,也可以操作成功

Payload:
  • file_id: int | str 💡 只能传入 1 个

  • file_id[0]: int | str 💡 如果有多个,则按顺序给出

  • file_id[1]: int | str

  • star: 0 | 1 = 1

fs_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_update(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

设置文件或目录(备注、标签、封面等)

POST https://proapi.115.com/open/ufile/update

Hint

即使文件已经被删除,也可以操作成功

Payload:
  • file_id: int | str 💡 只能传入 1 个

  • file_id[0]: int | str 💡 如果有多个,则按顺序给出

  • file_id[1]: int | str

  • file_name: str = <default> 💡 文件名

  • star: 0 | 1 = <default> 💡 是否星标:0:取消星标 1:设置星标

fs_update_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

设置文件或目录(备注、标签、封面等)

POST https://proapi.115.com/open/ufile/update

Hint

即使文件已经被删除,也可以操作成功

Payload:
  • file_id: int | str 💡 只能传入 1 个

  • file_id[0]: int | str 💡 如果有多个,则按顺序给出

  • file_id[1]: int | str

  • file_name: str = <default> 💡 文件名

  • star: 0 | 1 = <default> 💡 是否星标:0:取消星标 1:设置星标

fs_video(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频在线播放地址(和视频文件相关数据)

GET https://proapi.115.com/open/video/play

Hint

需切换音轨时,在请求返回的播放地址中增加请求参数 &audio_track=${index},值就是接口响应中 multitrack_list 中某个成员的索引,从 0 开始计数

Payload:
  • pick_code: str 💡 文件提取码

  • share_id: int | str = <default> 💡 共享 id,获取共享文件播放地址所需

fs_video_history(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_history(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取视频播放进度

GET https://proapi.115.com/open/video/history

Payload:
  • pick_code: str 💡 文件提取码

fs_video_history_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取视频播放进度

GET https://proapi.115.com/open/video/history

Payload:
  • pick_code: str 💡 文件提取码

fs_video_history_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_history_set(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

记忆视频播放进度

POST https://proapi.115.com/open/video/history

Payload:
  • pick_code: str 💡 文件提取码

  • time: int = <default> 💡 视频播放进度时长 (单位秒)

  • watch_end: int = <default> 💡 视频是否播放播放完毕 0:未完毕 1:完毕

fs_video_history_set_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

记忆视频播放进度

POST https://proapi.115.com/open/video/history

Payload:
  • pick_code: str 💡 文件提取码

  • time: int = <default> 💡 视频播放进度时长 (单位秒)

  • watch_end: int = <default> 💡 视频是否播放播放完毕 0:未完毕 1:完毕

fs_video_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取视频在线播放地址(和视频文件相关数据)

GET https://proapi.115.com/open/video/play

Hint

需切换音轨时,在请求返回的播放地址中增加请求参数 &audio_track=${index},值就是接口响应中 multitrack_list 中某个成员的索引,从 0 开始计数

Payload:
  • pick_code: str 💡 文件提取码

  • share_id: int | str = <default> 💡 共享 id,获取共享文件播放地址所需

fs_video_push(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_push(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

提交视频转码

POST https://proapi.115.com/open/video/video_push

Payload:
  • pick_code: str 💡 文件提取码

  • op: str = “vip_push” 💡 提交视频加速转码方式

    • “vip_push”: 根据;vip 等级加速

    • “pay_push”: 枫叶加速

fs_video_push_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

提交视频转码

POST https://proapi.115.com/open/video/video_push

Payload:
  • pick_code: str 💡 文件提取码

  • op: str = “vip_push” 💡 提交视频加速转码方式

    • “vip_push”: 根据;vip 等级加速

    • “pay_push”: 枫叶加速

fs_video_subtitle(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
fs_video_subtitle(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

视频字幕列表

GET https://proapi.115.com/open/video/subtitle

Payload:
  • pick_code: str 💡 文件提取码

fs_video_subtitle_open(payload: str | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

视频字幕列表

GET https://proapi.115.com/open/video/subtitle

Payload:
  • pick_code: str 💡 文件提取码

pickcode_stable_point

获取 pickcode 的不动点,或者也叫本征值

Todo

不动点可能和用户 id 有某种联系,但目前样本不足,难以推断,以后再尝试分析

recyclebin_clean(payload: int | str | Iterable[int | str] | dict = {}, /, password: str = '000000', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_clean(payload: int | str | Iterable[int | str] | dict = {}, /, password: str = '000000', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:删除或清空

POST https://proapi.115.com/open/rb/del

Note

password 参数是不用传的

Payload:
  • tid: int | str 💡 不传就是清空,多个用逗号 “,” 隔开

recyclebin_clean_open(payload: int | str | Iterable[int | str] | dict = {}, /, password: str = '000000', base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

回收站:删除或清空

POST https://proapi.115.com/open/rb/del

Note

password 参数是不用传的

Payload:
  • tid: int | str 💡 不传就是清空,多个用逗号 “,” 隔开

recyclebin_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_list(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:列表

GET https://proapi.115.com/open/rb/list

Payload:
  • limit: int = 32

  • offset: int = 0

recyclebin_list_open(payload: int | dict = 0, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

回收站:列表

GET https://proapi.115.com/open/rb/list

Payload:
  • limit: int = 32

  • offset: int = 0

recyclebin_revert(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
recyclebin_revert(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

回收站:还原

POST https://proapi.115.com/open/rb/revert

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • tid: int | str 💡 多个用逗号 “,” 隔开

recyclebin_revert_open(payload: int | str | Iterable[int | str] | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

回收站:还原

POST https://proapi.115.com/open/rb/revert

Caution

⚠️ 请不要并发执行,限制在 5 万个文件和目录以内

Payload:
  • tid: int | str 💡 多个用逗号 “,” 隔开

refresh_access_token(async_: Literal[False] = False, **request_kwargs) dict[source]
refresh_access_token(async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

更新 access_token 和 refresh_token (⚠️ 目前是 7200 秒内就要求刷新一次)

static to_id(pickcode: int | str, /) int

把可能是 id 或 pickcode 的一律转换成 id

Note

规定:根目录 id 为 0 对应的提取码是 “”

Parameters:

pickcode – 可能是 pickcode 或 id

Returns:

id

to_pickcode(id: int | str, /, prefix: Literal['a', 'b', 'c', 'd', 'e', 'fa', 'fb', 'fc', 'fd', 'fe'] = 'a', stable_point: str = '') str[source]

把可能是 id 或 pickcode 的一律转换成 pickcode

Note

规定:空提取码 “” 对应的 id 是 0

Parameters:
  • id – 可能是 id 或 pickcode

  • prefix – 前缀

  • stable_point – 提取码的本征值,不同用户的值不同,你也可以直接传一个此用户的有效 pickcode

Returns:

pickcode

upload_file(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead, pid: int | str = 0, share_id: int = 0, filename: str = '', filesha1: str = '', filesize: int = -1, dirname: str = '', payload: None | Mapping = None, partsize: int = 0, callback: None | dict = None, upload_id: str = '', endpoint: str = 'https://oss-cn-shenzhen.aliyuncs.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_file(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead, pid: int | str = 0, share_id: int = 0, filename: str = '', filesha1: str = '', filesize: int = -1, dirname: str = '', payload: None | Mapping = None, partsize: int = 0, callback: None | dict = None, upload_id: str = '', endpoint: str = 'https://oss-cn-shenzhen.aliyuncs.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

上传文件

Note

如果提供了 callback,则强制为分块上传。 此时,最好提供一下 upload_id,否则就是从头开始。 此时可以省略 pidfilenamefilesha1filesizepartsize

Caution

partsize > 0 时,不要把 partsize 设置得太小,起码得 10 MB (10485760) 以上

Parameters:
  • file – 待上传的文件

  • pid – 上传文件到此目录的 id 或 pickcode,或者指定的 target(格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”,但若 aid != 1,则会报参数错误)

  • share_id – 共享 id

  • filename – 文件名,如果为空,则会自动确定

  • filesha1 – 文件的 sha1,如果为空,则会自动确定

  • filesize – 文件大小,如果为 -1,则会自动确定

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • payload – 其它的查询参数

  • partsize – 分块上传的分块大小。如果为 0,则不做分块上传;如果 < 0,则会自动确定

  • callback – 回调数据

  • upload_id – 上传任务 id

  • endpoint – 上传目的网址

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_file_init(filename: str, filesha1: str, filesize: int, dirname: str = '', read_range_bytes_or_hash: None | Callable[[str], str | Buffer] = None, pid: int | str = 0, *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_file_init(filename: str, filesha1: str, filesize: int, dirname: str = '', read_range_bytes_or_hash: None | Callable[[str], str | Buffer] = None, pid: int | str = 0, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

初始化上传,可能秒传,此接口是对 upload_init_open 的封装

Note

  • 文件大小 和 sha1 是必需的,只有 sha1 是没用的。

  • 如果文件大于等于 1 MB (1048576 B),就需要 2 次检验一个范围哈希,就必须提供 read_range_bytes_or_hash

Parameters:
  • filename – 文件名

  • filesha1 – 文件的 sha1

  • filesize – 文件大小

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • read_range_bytes_or_hash

    调用以获取 2 次验证的数据或计算 sha1,接受一个数据范围,格式符合: HTTP Range Requests, 返回值如果是 str,则视为计算好的 sha1,如果为 Buffer,则视为数据(之后会被计算 sha1)

  • pid – 上传文件到此目录的 id,或者指定的 target(格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”,但若 aid != 1,则会报参数错误)

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_file_init_open(filename: str, filesha1: str, filesize: int, dirname: str = '', read_range_bytes_or_hash: None | Callable[[str], str | Buffer] = None, pid: int | str = 0, *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

初始化上传,可能秒传,此接口是对 upload_init_open 的封装

Note

  • 文件大小 和 sha1 是必需的,只有 sha1 是没用的。

  • 如果文件大于等于 1 MB (1048576 B),就需要 2 次检验一个范围哈希,就必须提供 read_range_bytes_or_hash

Parameters:
  • filename – 文件名

  • filesha1 – 文件的 sha1

  • filesize – 文件大小

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • read_range_bytes_or_hash

    调用以获取 2 次验证的数据或计算 sha1,接受一个数据范围,格式符合: HTTP Range Requests, 返回值如果是 str,则视为计算好的 sha1,如果为 Buffer,则视为数据(之后会被计算 sha1)

  • pid – 上传文件到此目录的 id,或者指定的 target(格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”,但若 aid != 1,则会报参数错误)

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_file_open(file: Buffer | str | PathLike | URL | SupportsGeturl | SupportsRead, pid: int | str = 0, share_id: int = 0, filename: str = '', filesha1: str = '', filesize: int = -1, dirname: str = '', payload: None | Mapping = None, partsize: int = 0, callback: None | dict = None, upload_id: str = '', endpoint: str = 'https://oss-cn-shenzhen.aliyuncs.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

上传文件

Note

如果提供了 callback,则强制为分块上传。 此时,最好提供一下 upload_id,否则就是从头开始。 此时可以省略 pidfilenamefilesha1filesizepartsize

Caution

partsize > 0 时,不要把 partsize 设置得太小,起码得 10 MB (10485760) 以上

Parameters:
  • file – 待上传的文件

  • pid – 上传文件到此目录的 id 或 pickcode,或者指定的 target(格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”,但若 aid != 1,则会报参数错误)

  • share_id – 共享 id

  • filename – 文件名,如果为空,则会自动确定

  • filesha1 – 文件的 sha1,如果为空,则会自动确定

  • filesize – 文件大小,如果为 -1,则会自动确定

  • dirname – 保存目录,是在 pid 对应目录下的相对路径,默认为 pid 所对应目录本身

  • payload – 其它的查询参数

  • partsize – 分块上传的分块大小。如果为 0,则不做分块上传;如果 < 0,则会自动确定

  • callback – 回调数据

  • upload_id – 上传任务 id

  • endpoint – 上传目的网址

  • async – 是否异步

  • request_kwargs – 其余请求参数

Returns:

接口响应

upload_gettoken_open(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_gettoken_open(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取阿里云 OSS 的 token(上传凭证)

GET https://proapi.115.com/open/upload/get_token

upload_init(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_init(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

初始化上传任务,可能秒传

POST https://proapi.115.com/open/upload/init

Payload:
  • file_name: str 💡 文件名

  • fileid: str 💡 文件的 sha1 值

  • file_size: int 💡 文件大小,单位是字节

  • target: str 💡 上传目标,格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”

  • topupload: int = 0 💡 上传调度文件类型调度标记

    • 0: 单文件上传任务标识 1 条单独的文件上传记录

    • 1: 目录任务调度的第 1 个子文件上传请求标识 1 次目录上传记录

    • 2: 目录任务调度的其余后续子文件不作记作单独上传的上传记录

    • -1: 没有该参数

  • sign_key: str = “” 💡 2 次验证时读取文件的范围

  • sign_val: str = “” 💡 2 次验证的签名值

upload_init_open(payload: dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

初始化上传任务,可能秒传

POST https://proapi.115.com/open/upload/init

Payload:
  • file_name: str 💡 文件名

  • fileid: str 💡 文件的 sha1 值

  • file_size: int 💡 文件大小,单位是字节

  • target: str 💡 上传目标,格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”

  • topupload: int = 0 💡 上传调度文件类型调度标记

    • 0: 单文件上传任务标识 1 条单独的文件上传记录

    • 1: 目录任务调度的第 1 个子文件上传请求标识 1 次目录上传记录

    • 2: 目录任务调度的其余后续子文件不作记作单独上传的上传记录

    • -1: 没有该参数

  • sign_key: str = “” 💡 2 次验证时读取文件的范围

  • sign_val: str = “” 💡 2 次验证的签名值

upload_resume(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
upload_resume(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取恢复断点续传所需信息

POST https://proapi.115.com/open/upload/resume

Payload:
  • pick_code: str 💡 上传任务 key

  • target: str 💡 上传目标,默认为 “U_1_0”,格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”

  • fileid: str 💡 文件的 sha1 值(⚠️ 可以是任意值)

  • file_size: int 💡 文件大小,单位是字节(⚠️ 可以是任意值)

upload_resume_open(payload: dict | str, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取恢复断点续传所需信息

POST https://proapi.115.com/open/upload/resume

Payload:
  • pick_code: str 💡 上传任务 key

  • target: str 💡 上传目标,默认为 “U_1_0”,格式为 f”U_{aid}_{pid}” 或 f”S_{share_id}_{pid}”

  • fileid: str 💡 文件的 sha1 值(⚠️ 可以是任意值)

  • file_size: int 💡 文件大小,单位是字节(⚠️ 可以是任意值)

user_info(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
user_info(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取用户信息

GET https://proapi.115.com/open/user/info

user_info_open(base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取用户信息

GET https://proapi.115.com/open/user/info

vip_qr_url(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False] = False, **request_kwargs) dict[source]
vip_qr_url(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, dict]

获取产品列表地址(即引导用户扫码购买 115 的 VIP 服务,以获取提成)

GET https://proapi.115.com/open/vip/qr_url

Payload:
  • open_device: int

  • default_product_id: int = <default> 💡 打开产品列表默认选中的产品对应的产品id,如果没有则使用默认的产品顺序。

    • 月费: 5

    • 年费: 1

    • 尝鲜1天: 101

    • 长期VIP(长期): 24072401

    • 超级VIP: 24072402

vip_qr_url_open(payload: int | dict, /, base_url: str | Callable[[], str] = 'https://proapi.115.com', *, async_: Literal[False, True] = False, **request_kwargs) dict | Coroutine[Any, Any, dict]

获取产品列表地址(即引导用户扫码购买 115 的 VIP 服务,以获取提成)

GET https://proapi.115.com/open/vip/qr_url

Payload:
  • open_device: int

  • default_product_id: int = <default> 💡 打开产品列表默认选中的产品对应的产品id,如果没有则使用默认的产品顺序。

    • 月费: 5

    • 年费: 1

    • 尝鲜1天: 101

    • 长期VIP(长期): 24072401

    • 超级VIP: 24072402

p115client.client.check_response(resp: dict, /) dict[source]
p115client.client.check_response(resp: Awaitable[dict], /) Coroutine[Any, Any, dict]

检测 115 的某个接口的响应,如果成功则直接返回,否则根据具体情况抛出一个异常,基本上是 OSError 的实例