generated from kgod/ai-review-template
34 lines
698 B
Python
34 lines
698 B
Python
"""状态定义"""
|
|
from typing import TypedDict
|
|
from playwright.async_api import Page
|
|
|
|
|
|
class NextPageState(TypedDict, total=False):
|
|
"""下一页选择器分析状态"""
|
|
|
|
# 输入
|
|
url: str
|
|
page: Page
|
|
|
|
# 节点1: fetch_page
|
|
html: str
|
|
|
|
# 节点2: find_pagination_area
|
|
pagination_selector: str
|
|
pagination_html: str
|
|
has_pagination: int # 0=无分页, 1=有分页
|
|
|
|
# 节点3: find_next_button
|
|
selector: str
|
|
|
|
# 节点4: validate_next
|
|
change_type: str # url_change / content_change / new_tab / no_change
|
|
is_valid: bool
|
|
|
|
# 重试
|
|
failed_selectors: list[str]
|
|
retry_count: int
|
|
|
|
# 错误
|
|
error: str
|