Skip to content

Commit 2306f69

Browse files
authored
Merge pull request #104 from NovaShen555/master
fix: get_dir_list因缺少uid不可用
2 parents 73022ef + 59ca465 commit 2306f69

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lanzou/api/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(self):
5555
'Referer': 'https://pc.woozooo.com/mydisk.php',
5656
'Accept-Language': 'zh-CN,zh;q=0.9', # 提取直连必需设置这个,否则拿不到数据
5757
}
58+
self._uid = 0 # uid 用于上传文件时的参数
5859
disable_warnings(InsecureRequestWarning) # 全局禁用 SSL 警告
5960

6061
def _get(self, url, **kwargs):
@@ -143,6 +144,7 @@ def get_cookie(self) -> dict:
143144

144145
def login_by_cookie(self, cookie: dict) -> int:
145146
"""通过cookie登录"""
147+
self._uid = cookie['ylogin'] # 将cookie的uid保存下来用于上传函数
146148
self._session.cookies.update(cookie)
147149
html = self._get(self._account_url)
148150
if not html:
@@ -388,7 +390,7 @@ def get_dir_list(self, folder_id=-1) -> FolderList:
388390
"""获取子文件夹列表"""
389391
folder_list = FolderList()
390392
post_data = {'task': 47, 'folder_id': folder_id}
391-
resp = self._post(self._doupload_url, post_data)
393+
resp = self._post(self._doupload_url+"?uid="+str(self._uid), post_data) # 上传文件时需要 uid 参数
392394
if not resp:
393395
return folder_list
394396
for folder in resp.json()['text']:

0 commit comments

Comments
 (0)