xpzouying/xiaohongshu-mcp · error
评论未确认成功:提交后未在评论区出现(可能账号被限制或发送失败),feed: %s
Error message
评论未确认成功:提交后未在评论区出现(可能账号被限制或发送失败),feed: %s
What it means
PostComment verifies success by checking the comment actually renders in the comment list within 4 seconds (waitCommentRendered). If it never appears, the library refuses to report fake success and returns this error, noting the account may be limited or the send failed.
Source
Thrown at xiaohongshu/comment_feed.go:82
humanize.Delay(ctx, humanize.AfterType)
submitButton, err := page.Element("div.bottom button.submit")
if err != nil {
logrus.Warnf("Failed to find submit button: %v", err)
return fmt.Errorf("未找到提交按钮: %w", err)
}
if err := humanize.Click(submitButton); err != nil {
logrus.Warnf("Failed to click submit button: %v", err)
return fmt.Errorf("无法点击提交按钮: %w", err)
}
humanize.Delay(ctx, humanize.AfterClick)
// 就地校验:提交后评论应在评论区渲染出现;未出现则判定失败,避免假成功。
if !waitCommentRendered(page, content, 4*time.Second) {
logrus.Warnf("评论提交后未在评论区渲染,判定未成功: feed=%s", feedID)
return fmt.Errorf("评论未确认成功:提交后未在评论区出现(可能账号被限制或发送失败),feed: %s", feedID)
}
logrus.Infof("Comment posted and verified to feed: %s", feedID)
return nil
}
// commentRendered 就地读当前页评论区 DOM,判断指定文本的评论是否已渲染出现。
// 不重新导航、不滚动——只读已加载的 .comments-container 的可见文本。
func commentRendered(page *rod.Page, content string) bool {
res, err := page.Eval(`(txt) => {
const c = document.querySelector('.comments-container');
return c ? c.innerText.includes(txt) : false;
}`, content)
if err != nil {
return false
}
return res.Value.Bool()
}View on GitHub (pinned to 332d196854)
Solutions
- Reduce comment frequency and let the account cool down (risk control)
- Remove links/sensitive words from the comment content and retry
- Re-login to refresh the session, then verify commenting works manually in a browser
- Increase the verification wait if pages load slowly (library-level change to waitCommentRendered timeout)
Example fix
// before
count := 0
for { _ = svc.PostComment(ctx, feed, "看这里 http://spam.example") ; count++ } // triggers filtering
// after
if rateLimitedRecently() { return errors.New("cooling down") }
_ = svc.PostComment(ctx, feed, "写得真好,学习了") // clean content, throttled Defensive patterns
Strategy: try-catch
Validate before calling
// 提交前自查内容风控风险
if strings.ContainsAny(content, "http:/") || utf8.RuneCountInString(content) < 2 {
return errors.New("评论含链接或过短,易被过滤")
} Try / catch
err := svc.PostComment(ctx, feedID, content)
if err != nil && strings.Contains(err.Error(), "评论未确认成功") {
// 不要立即重试:先降频、换内容,或检查账号状态
log.Warnf("评论可能被风控过滤: %v", err)
time.Sleep(10 * time.Minute)
} Prevention
- 降低评论频率,间隔数分钟以上
- 避免链接、敏感词、重复文案
- 定期人工浏览器验证账号评论是否正常
- 保持会话新鲜,过期及时重登
When it happens
Trigger: Submit click succeeded mechanically but the comment was silently rejected: account shadow-banned/rate-limited, comment blocked by sensitive-word filtering, login expired so the action was discarded, or the 4s render window was too short on a slow page.
Common situations: Accounts under risk control after high-frequency commenting; comments containing links or flagged keywords filtered by XHS; expired session where clicks do nothing; heavy network latency exceeding the 4s verification window.
Related errors
- 未找到评论输入框,该帖子可能不支持评论或网页端不可访问: %w
- 未找到评论输入区域: %w
- 回复未确认成功:提交后未在评论区出现(可能账号被限制或发送失败)
- 回复未确认成功:发送后输入框仍未收起(可能被限制或发送失败)
- ErrNoFeeds
AI-assisted analysis of xpzouying/xiaohongshu-mcp@332d196854 (2026-09-05).
Data as JSON: /api/errors/fb1bd603b2c7d63f.
Report an issue: GitHub.