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

响应中含有webpage参数正则解析失败问题和解决办法 #81

Closed
Lycheenut opened this issue Aug 7, 2022 · 2 comments
Closed

Comments

@Lycheenut
Copy link

Lycheenut commented Aug 7, 2022

响应中含有webpage参数的情况参见问题#74
在该情况下,websignwebsignkey这两个参数的正则解析失败,这是由于这两个参数的名字已变为awebsignacwebsignkeyc
在lanzou/api/core.py的第519~520行,对正则表达式进行相应的修改即可:

web_sign = re.search(r"var awebsigna\s*=\s*'(.+?)';", first_page).group(1)
web_sign_key = re.search(r"var cwebsignkeyc\s*=\s*'(.+?)';", first_page).group(1)

此外,直接对正则解析的返回对象的域取值是不安全的,因为返回对象有可能是None。推荐对re.search的返回值进行判空,或采用异常处理包装。

@zaxtyson
Copy link
Owner

zaxtyson commented Oct 7, 2022

fixed,🤧抱歉这么久才修,因为实习还有其它事情耽搁了

zaxtyson added a commit to zaxtyson/LanZouCloud-CMD that referenced this issue Oct 7, 2022
@Lycheenut
Copy link
Author

辛苦了,非常感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants