Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_folder_info_by_url也需要处理js加密 #58

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lanzou/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,15 @@ def get_folder_info_by_url(self, share_url, dir_pwd='') -> FolderDetail:
# 要求输入密码, 用户描述中可能带有"输入密码",所以不用这个字符串判断
if ('id="pwdload"' in html or 'id="passwddiv"' in html) and len(dir_pwd) == 0:
return FolderDetail(LanZouCloud.LACK_PASSWORD)

if "acw_sc__v2" in html:
# 在页面被过多访问或其他情况下,有时候会先返回一个加密的页面,其执行计算出一个acw_sc__v2后放入页面后再重新访问页面才能获得正常页面
# 若该页面进行了js加密,则进行解密,计算acw_sc__v2,并加入cookie
acw_sc__v2 = calc_acw_sc__v2(html)
self._session.cookies.set("acw_sc__v2", acw_sc__v2)
logger.debug(f"Set Cookie: acw_sc__v2={acw_sc__v2}")
html = self._get(share_url).text # 文件分享页面(第一页)

try:
# 获取文件需要的参数
html = remove_notes(html)
Expand Down