refactor: 简化命令行参数命名

- 将 --max_comments_per_post 重命名为 --max_comments_count_singlenotes,与配置项名称保持一致
- 移除 --xhs_sort_type 参数(暂不需要)
- 保持代码简洁,减少不必要的功能
This commit is contained in:
wanzirong
2026-01-21 16:30:07 +08:00
parent f7d27ab43a
commit 90f72536ba

View File

@@ -250,22 +250,14 @@ async def parse_cmd(argv: Optional[Sequence[str]] = None):
rich_help_panel="Basic Configuration",
),
] = "",
max_comments_per_post: Annotated[
max_comments_count_singlenotes: Annotated[
int,
typer.Option(
"--max_comments_per_post",
"--max_comments_count_singlenotes",
help="Maximum number of first-level comments to crawl per post/video",
rich_help_panel="Comment Configuration",
),
] = config.CRAWLER_MAX_COMMENTS_COUNT_SINGLENOTES,
xhs_sort_type: Annotated[
str,
typer.Option(
"--xhs_sort_type",
help="XiaoHongShu sort type (e.g., popularity_descending, time_descending)",
rich_help_panel="Platform Specific Configuration",
),
] = "",
) -> SimpleNamespace:
"""MediaCrawler 命令行入口"""
@@ -290,11 +282,7 @@ async def parse_cmd(argv: Optional[Sequence[str]] = None):
config.CDP_HEADLESS = enable_headless
config.SAVE_DATA_OPTION = save_data_option.value
config.COOKIES = cookies
config.CRAWLER_MAX_COMMENTS_COUNT_SINGLENOTES = max_comments_per_post
# Set XiaoHongShu sort type if specified
if xhs_sort_type and platform == PlatformEnum.XHS:
config.SORT_TYPE = xhs_sort_type
config.CRAWLER_MAX_COMMENTS_COUNT_SINGLENOTES = max_comments_count_singlenotes
# Set platform-specific ID lists for detail/creator mode
if specified_id_list: