download#
下载
- p123client.tool.download.get_downurl(client: P123Client, uri: int | str, quoted: bool = True, *, async_: Literal[False] = False, **request_kwargs) str[source]#
- p123client.tool.download.get_downurl(client: P123Client, uri: int | str, quoted: bool = True, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, str]
获取下载链接
- Parameters:
client – 123 网盘的客户端对象
uri –
如果是 int,则视为文件 id(必须存在你网盘);如果是 str,则视为自定义链接
Note
自定义链接的格式为 f”123://{name}|{size}|{md5}?{s3_key_flag}”,前面的 “123://” 和后面的 “?{s3_key_flag}” 都可省略
如果省略 “?{s3_key_flag}”,则会尝试先秒传到你的网盘的 “/我的秒传” 目录下,名字为 f”{md5}-{size}” 的文件,然后再获取下载链接
quoted – 说明链接已经过 quote 处理,所以使用时需要 unquote 回来
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
下载链接
- p123client.tool.download.make_uri(client: P123Client, file_id: int, ensure_ascii: bool = False, *, async_: Literal[False] = False, **request_kwargs) str[source]#
- p123client.tool.download.make_uri(client: P123Client, file_id: int, ensure_ascii: bool = False, *, async_: Literal[True], **request_kwargs) Coroutine[Any, Any, str]
创建自定义 uri,格式为 f”123://{name}|{size}|{md5}?{s3_key_flag}”
- Parameters:
client – 123 网盘的客户端对象
file_id – 文件 id
ensure_ascii – 是否要求全部字符在 ASCII 范围内
async – 是否异步
request_kwargs – 其它请求参数
- Returns:
自定义 uri