feat: 优化养号流程调用,确保向后兼容

This commit is contained in:
Your Name committed 2026-01-15 03:15:33 +08:00
1 parent e898202a90
commit e39a984260
2 files changed
+11 -35

No files matched your search

+11 -1
View File
@@ -455,7 +455,17 @@ def main(argv: list[str]) -> int:
seconds = int(getattr(args, "test_yanghao_flow_seconds", 10) or 10)
if seconds < 1:
seconds = 1
getattr(analyser, "_yanghao_recommend_flow", lambda _: None)(seconds) # type: ignore[attr-defined]
# 优先使用实例方法;若不存在或不可调用,则直接调用模块实现以保证向后兼容
try:
fn = getattr(analyser, "_yanghao_recommend_flow", None)
if callable(fn):
fn(seconds) # type: ignore[arg-type]
else:
from douyin.other import douyin_yanghao
douyin_yanghao.yanghao_recommend_flow(analyser, seconds)
except Exception as e:
print(f"[YANGHAO-ONLY] 调用养号流程失败: {e}")
print("[TEST] done")
return 0