Skip to content

Commit

Permalink
Merge pull request #104 from NovaShen555/master
Browse files Browse the repository at this point in the history
fix: get_dir_list因缺少uid不可用
  • Loading branch information
zaxtyson authored Mar 3, 2024
2 parents 73022ef + 59ca465 commit 2306f69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lanzou/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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']:
Expand Down

0 comments on commit 2306f69

Please sign in to comment.