Skip to content

Commit

Permalink
fixed #55
Browse files Browse the repository at this point in the history
  • Loading branch information
zaxtyson committed Apr 7, 2021
1 parent 03c5543 commit d532fb6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 37 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@

# 更新日志

## `v2.6.3`

- 修复下载页的 Cookie 验证问题[#55](https://github.com/zaxtyson/LanZouCloud-API/pull/55)

## `v2.6.2`

- 修复文件后缀非小写导致的误判问题[#92](https://github.com/rachpt/lanzou-gui/issues/92)
Expand Down
2 changes: 1 addition & 1 deletion lanzou/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from lanzou.api.core import LanZouCloud

version = '2.6.2'
version = '2.6.3'

__all__ = ['utils', 'types', 'models', 'LanZouCloud', 'version']
4 changes: 2 additions & 2 deletions lanzou/api/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ def get_file_info_by_url(self, share_url, pwd='') -> FileDetail:
if not first_page:
return FileDetail(LanZouCloud.NETWORK_ERROR, pwd=pwd, url=share_url)

if "var arg1=" in first_page.text:
if "acw_sc__v2" in first_page.text:
# 在页面被过多访问或其他情况下,有时候会先返回一个加密的页面,其执行计算出一个acw_sc__v2后放入页面后再重新访问页面才能获得正常页面
# 若该页面进行了js加密,则进行解密,计算acw_sc__v2,并加入cookie
# 可以测试的链接:https://fzls.lanzous.com/iDBM7nbkzti ,使用隐私模式打开(确保无cookie),会注意到第一次访问时会返回形如下面这样的页面,会计算acw_sc__v2并设置cookie后reload,之后会返回正常的页面
acw_sc__v2 = calc_acw_sc__v2(first_page.text)
self._session.cookies.set("acw_sc__v2", acw_sc__v2)
logger.debug(f"Set Cookie: acw_sc__v2={acw_sc__v2}")
first_page = self._get(share_url) # 文件分享页面(第一页)
if not first_page:
return FileDetail(LanZouCloud.NETWORK_ERROR, pwd=pwd, url=share_url)
Expand Down
Loading

0 comments on commit d532fb6

Please sign in to comment.