diff --git a/douyin/fudai/douyin_fudai_core.py b/douyin/fudai/douyin_fudai_core.py index fe23d72..e70211e 100644 --- a/douyin/fudai/douyin_fudai_core.py +++ b/douyin/fudai/douyin_fudai_core.py @@ -15,6 +15,7 @@ from douyin.core import path_config from douyin.fudai.core.fudai_filter import ( is_watch_task_fudai, _is_short_countdown_text, + check_contain, ) from douyin.fudai.core.fudai_result_checker import ( check_lucky_draw_result, @@ -2130,53 +2131,8 @@ def get_fudai_contain(analyser, renwu: int = 2) -> Tuple[str, str, int, int, flo return fudai_content_text, time_text, participants, copies, prize_value_yuan -def check_contain(analyser, contains: str = "") -> bool: - """检查福袋内容是否命中“黑名单”关键词(只保留黑名单逻辑,不再使用白名单)。 - - 返回值语义(调整后): - - True : “建议丢弃”(内容命中黑名单 contains_not_want) - - False : “可以保留”(未命中黑名单) - """ - - # 以下抑制为静态检查方便添加: - # - W0212: protected-access(许多地方访问分析器/底层对象的受保护属性,运行时可用) - # - W0718: broad-exception-caught(代码中大量使用 broad except 用于鲁棒性) - # 这些抑制只影响静态检查,不改变运行时行为。 - # pylint: disable=W0212,W0718 - try: - for contain in getattr(analyser, "contains_not_want", []) or []: - if contain and contain in (contains or ""): - try: - analyser._log_kv( - "筛选", - "福袋内容命中黑名单,将丢弃", - keyword=contain, - contains=contains[:80] if contains else "", - ) - except Exception: - pass - return True - - try: - analyser._log_kv( - "筛选", - "福袋内容未命中黑名单,保留", - contains=contains[:80] if contains else "", - ) - except Exception: - pass - return False - except Exception: - # 容错:异常时不过滤 - try: - analyser._log_kv( - "筛选", - "check_contain 异常,默认保留", - contains=contains[:80] if contains else "", - ) - except Exception: - pass - return False +# check_contain 已迁移到 douyin.fudai.core.fudai_filter(顶部导入)。 +# 此处保留模块级名称以兼容历史 from douyin_fudai_core import check_contain。 def attend_choujiang(analyser) -> bool: