feat: 添加小红书Feed评论功能 (#50)

实现通过HTTP GIN API和MCP API发表评论到小红书Feed的功能:
- 新增POST /api/v1/feeds/comment端点
- 新增post_comment_to_feed MCP工具
- 添加PostCommentRequest和PostCommentResponse类型
- 实现PostCommentToFeed服务方法
- 新增CommentFeedAction用于浏览器自动化操作

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
zy
2025-09-09 23:13:05 +08:00
committed by GitHub
parent 8fdb461f8f
commit cd28e4064e
8 changed files with 204 additions and 1 deletions

View File

@@ -192,3 +192,30 @@ func (s *XiaohongshuService) GetFeedDetail(ctx context.Context, feedID, xsecToke
return response, nil
}
// PostCommentToFeed 发表评论到Feed
func (s *XiaohongshuService) PostCommentToFeed(ctx context.Context, feedID, xsecToken, content string) (*PostCommentResponse, error) {
// 使用非无头模式以便查看操作过程
b := browser.NewBrowser(false)
defer b.Close()
page := b.NewPage()
defer page.Close()
// 创建 Feed 评论 action
action := xiaohongshu.NewCommentFeedAction(page)
// 发表评论
err := action.PostComment(ctx, feedID, xsecToken, content)
if err != nil {
return nil, err
}
response := &PostCommentResponse{
FeedID: feedID,
Success: true,
Message: "评论发表成功",
}
return response, nil
}