feat(08-02): implement crawl_comments method with hot sorting

- Add COMMENT_API_TEMPLATE for comment API URL
- Implement crawl_comments() returning CommentsResult
- Use order=hot for popular comments sorting
- Only fetch first-level comments (no nested replies)
- Add include_comments parameter to crawl_answer()
- Export CommentAuthor, CommentData, CommentsResult in __init__.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 21:56:47 +08:00
parent 8cc46965c1
commit f41e75a1b2
3 changed files with 162 additions and 22 deletions
+16
View File
@@ -8,8 +8,17 @@ from .models import (
ContentMetadata,
AnswerData,
ArticleData,
CommentAuthor,
CommentData,
CommentsResult,
CrawlResult,
)
from .config import (
ProxyConfig,
CrawlerConfig,
get_crawler_config,
reset_crawler_config,
)
from .zhihu_crawler import ZhihuCrawler, ZhihuApiInterceptor
__all__ = [
@@ -17,7 +26,14 @@ __all__ = [
"ContentMetadata",
"AnswerData",
"ArticleData",
"CommentAuthor",
"CommentData",
"CommentsResult",
"CrawlResult",
"ProxyConfig",
"CrawlerConfig",
"get_crawler_config",
"reset_crawler_config",
"ZhihuCrawler",
"ZhihuApiInterceptor",
]