-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
✨ feat: 添加大会员失效时退出 #134
✨ feat: 添加大会员失效时退出 #134
Conversation
README.md
Outdated
@@ -409,6 +409,11 @@ cat ~/.yutto_alias | yutto tensura-nikki --batch --alias-file - | |||
- 参数 `--metadata-only` | |||
- 默认值 `False` | |||
|
|||
#### 严格校验大会员状态有效 | |||
|
|||
- 参数 `--vip-check` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是否可以修改下参数名称,比如加上 force
、strict
这样的修饰,因为 vip_check
现在是有的,只是不会退出
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一开始我是打算叫vip_strict
的,那就用一开始的吧,我改一下
yutto/__main__.py
Outdated
@@ -256,6 +263,9 @@ async def run(args_list: list[argparse.Namespace]): | |||
f"{episode_data['filename']}", | |||
Badge(f"[{i+1}/{len(download_list)}]", fore="black", back="cyan"), | |||
) | |||
if args.vip_check and not await validate_vip(): | |||
Logger.error("启用了严格校验大会员模式,请检查SESSDATA或大会员状态!") | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
批量下载时,大会员因为多端登录、大量下载行为而冻结,需要等待30min或主动刷新
这种情况是可能发生在这个循环中的是嘛?如果是的话我觉得没问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯是的,循环中间大会员失效了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过需要关注一个不太优雅的问题:
[876/1256] ...
ERROR 启用了严格校验大会员模式,请检查SESSDATA或大会员状态!
/Users/lc4t/miniforge3/lib/python3.9/asyncio/events.py:80: RuntimeWarning: coroutine 'extract_ugc_video_data' was never awaited
self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
# 然后就退出了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这应该是一个已知问题,可以提交一个 issue,我会在之后修复一下~
用户的 KeyboardInterrupt 也会触发该问题
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦原来是这样,我以为是我引入的,ok~
@@ -254,6 +254,9 @@ async def run(args_list: list[argparse.Namespace]): | |||
for i, episode_data_coro in enumerate(download_list): | |||
if episode_data_coro is None: | |||
continue | |||
if args.vip_strict and not await validate_vip(): | |||
Logger.error("启用了严格校验大会员模式,请检查SESSDATA或大会员状态!") | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
推测是episode_data_coro没有执行完毕但return导致RuntimeWarning
是 episode_data_coro 创建了,但没有 await,download_list 后续循环里还有很多这样子的 item,调整这里的顺序是没有用的,这个我会在之后有时间的时候提一个 PR 统一修复
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,不过就保持这个顺序吧,检查大会员在await episode_data_coro
前,如果失效就会少请求几次
动机
批量下载时,大会员因为多端登录、大量下载行为而冻结,需要等待30min或主动刷新,此时,下载到的视频是无大会员情况下的清晰度。
也就是 #133 的
A2
问题。解决方案
提供一个
--vip-check
参数,给定时,会在下载前校验大会员状态,如果异常则直接退出。ps: 在run()函数中直接return,不知道是否会引起其他异常?
类型