NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
一个 Tampermonkey 油猴脚本,一键导出知乎问题下的回答内容、所有评论和评论的评论(子评论),支持 JSON 和 Markdown 两种格式。
打开知乎问题页面(如 zhihu.com/question/123456)或具体回答页面(如 zhihu.com/question/123456/answer/789012):
{
"exportedAt": "2026-06-17T...",
"url": "https://www.zhihu.com/question/...",
"questionTitle": "问题标题",
"answers": [
{
"author": { "name": "作者名", "headline": "作者简介" },
"content": "<p>回答 HTML</p>",
"contentText": "回答纯文本",
"voteupCount": 937,
"commentCount": 107,
"totalRootComments": 107,
"totalChildComments": 45,
"comments": [
{
"id": "11202932515",
"content": "评论内容",
"author": { "name": "评论者", "isAuthor": false },
"createdTime": 1749844557,
"likeCount": 54,
"location": "湖南",
"childCommentCount": 9,
"childComments": [
{
"content": "子评论内容",
"author": { "name": "回复者", "isAuthor": true },
...
}
]
}
]
}
]
}
# 问题标题
## 作者名
*作者简介*
👍 937 赞同 | 💬 107 评论 | 45 子评论
### 📝 回答内容
回答正文...
### 💬 评论 (107 条)
**评论者A**
> 评论内容
> 👍54 📍湖南 · 2025/6/14 10:00:00
**评论者B** 🅰️
> 回复内容
> 👍6 · 2025/6/14 14:00:00
| 数据 | 来源 | 说明 |
|---|---|---|
| 回答内容 | 页面 SSR 数据 + DOM | 优先取 DOM 中展开后的完整内容 |
| 根评论 | /api/v4/comment_v5/answers/{id}/root_comment |
无需登录,自动分页 |
| 子评论 | 根评论 API 响应中的 child_comments[] |
已包含,支持 child_comment_offset 分页 |
GET /api/v4/comment_v5/answers/{answer_id}/root_comment
?order_by=score
&limit=20
&offset=
Response:
{
"counts": { "total_counts": 107 },
"data": [{
"id": "...",
"content": "...",
"author": { "name": "...", "url_token": "..." },
"like_count": 54,
"child_comment_count": 9,
"child_comments": [ ... ],
"child_comment_next_offset": "..."
}],
"paging": { "is_end": false, "next": "https://..." }
}
脚本顶部的 CONFIG 对象可调整:
const CONFIG = {
commentPageSize: 20, // 每页评论数
maxRootComments: 0, // 最大根评论数(0=不限)
maxChildComments: 0, // 最大子评论数(0=不限)
requestDelay: 300, // API 请求间隔(ms)
expandRetryCount: 10, // 展开内容重试次数
expandRetryDelay: 500, // 展开内容重试间隔(ms)
};
/question/{id}/answer/{answerId}/question/{id}(导出页面上所有可见回答).AnswerItem)MIT
Rating: 0