- Removed trailing whitespace and ensured files end with a single newline in cleanup_unused_files.py. - Added fix_trailing_whitespace.py to batch remove trailing whitespace from Python files. - Updated install_dependencies.py to improve dependency installation prompts. - Cleaned up pick_coords.py by removing unnecessary whitespace and improving code readability. - Enhanced region_selector.py by disabling specific pylint checks for better compatibility with third-party libraries. - Improved WPS流程图生成工具.py by cleaning up whitespace and enhancing readability. - Updated __init__.py in typings to remove unnecessary lines. - Modified app.js to adjust default configuration values and clean up unused code.
43 lines
1023 B
Python
43 lines
1023 B
Python
from __future__ import annotations
|
|
|
|
"""
|
|
弹窗处理模块
|
|
============
|
|
|
|
职责:弹窗检测和处理
|
|
- 检测优惠券弹窗
|
|
- 检测购物红包弹窗
|
|
"""
|
|
|
|
from typing import Any
|
|
|
|
from douyin.other import douyin_popups
|
|
|
|
|
|
class PopupHandler:
|
|
"""弹窗处理器:统一管理弹窗处理"""
|
|
|
|
@staticmethod # type: ignore[misc]
|
|
def check_coupon_popup(analyser: Any) -> bool:
|
|
"""购物券 / 新客专享券 等底部营销弹窗(仅在详情链路外的"看门狗"中使用)。
|
|
|
|
参数:
|
|
analyser: 分析器对象
|
|
|
|
返回:
|
|
bool: 是否检测到弹窗
|
|
"""
|
|
return douyin_popups.check_coupon_popup(analyser)
|
|
|
|
@staticmethod # type: ignore[misc]
|
|
def check_shopping_redpacket_popup(analyser: Any) -> bool:
|
|
"""购物红包中央弹窗。
|
|
|
|
参数:
|
|
analyser: 分析器对象
|
|
|
|
返回:
|
|
bool: 是否检测到弹窗
|
|
"""
|
|
return douyin_popups.check_shopping_redpacket_popup(analyser)
|