feat: 启动任务接口添加帖子/视频数量与评论数量覆盖支持#900
Open
zanmeipaul wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background / 背景
目前在 WebUI 或通过 API 启动爬虫任务时,最大爬取帖子/视频数 (
CRAWLER_MAX_NOTES_COUNT) 和每篇帖子最大评论数 (CRAWLER_MAX_COMMENTS_COUNT_SINGLENOTES) 只能使用静态配置文件中的默认值。若想在启动不同任务时采用不同的数量限制,必须修改本地配置文件,这对 API 集中化调度和多任务动态配置不够友好。Changes / 变更内容
api/schemas/crawler.py):CrawlerStartRequest结构体中添加了max_notes_count和max_comments_count两个可选整型字段。cmd_arg/arg.py):--crawler_max_notes_count选项以支持覆盖config.CRAWLER_MAX_NOTES_COUNT,原有--max_comments_count_singlenotes保持不变。api/services/crawler_manager.py):tests/test_api_limits.py):Test / 验证情况
pytest tests/test_api_limits.py与pytest tests/test_cmd_arg_tieba.py均顺利通过。