From 59ca465d36bea77b9a1e1343a93c2bca884738e2 Mon Sep 17 00:00:00 2001 From: NovaShen555 Date: Sat, 2 Mar 2024 13:20:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20get=5Fdir=5Flist=E5=9B=A0=E7=BC=BA?= =?UTF-8?q?=E5=B0=91uid=E4=B8=8D=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lanzou/api/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lanzou/api/core.py b/lanzou/api/core.py index 2aec380..9017c90 100644 --- a/lanzou/api/core.py +++ b/lanzou/api/core.py @@ -55,6 +55,7 @@ def __init__(self): 'Referer': 'https://pc.woozooo.com/mydisk.php', 'Accept-Language': 'zh-CN,zh;q=0.9', # 提取直连必需设置这个,否则拿不到数据 } + self._uid = 0 # uid 用于上传文件时的参数 disable_warnings(InsecureRequestWarning) # 全局禁用 SSL 警告 def _get(self, url, **kwargs): @@ -143,6 +144,7 @@ def get_cookie(self) -> dict: def login_by_cookie(self, cookie: dict) -> int: """通过cookie登录""" + self._uid = cookie['ylogin'] # 将cookie的uid保存下来用于上传函数 self._session.cookies.update(cookie) html = self._get(self._account_url) if not html: @@ -388,7 +390,7 @@ def get_dir_list(self, folder_id=-1) -> FolderList: """获取子文件夹列表""" folder_list = FolderList() post_data = {'task': 47, 'folder_id': folder_id} - resp = self._post(self._doupload_url, post_data) + resp = self._post(self._doupload_url+"?uid="+str(self._uid), post_data) # 上传文件时需要 uid 参数 if not resp: return folder_list for folder in resp.json()['text']: