Skip to content

feat: 支持解析并返回评论中的图片#61

Open
yskhhh wants to merge 1 commit intoautoclaw-cc:mainfrom
yskhhh:feat/comment-pictures
Open

feat: 支持解析并返回评论中的图片#61
yskhhh wants to merge 1 commit intoautoclaw-cc:mainfrom
yskhhh:feat/comment-pictures

Conversation

@yskhhh
Copy link
Copy Markdown

@yskhhh yskhhh commented Mar 25, 2026

问题

小红书评论支持发送图片,服务端在 INITIAL_STATE 中通过
pictures 字段返回图片信息。但原有 Comment 类未声明该字段,
导致图片评论的 content 为空字符串,图片数据完全丢失。

受影响场景:晒穿搭、晒产品等以图片为主的评论,
在 get-feed-detail 返回结果中无法获取任何有效内容。

修复

  • 新增 CommentPicture 数据类,包含 widthheighturlDefaulturlPre
  • Comment 增加 pictures: list[CommentPicture] 字段
  • from_dict 解析 pictures 数组(兼容空列表)
  • to_dict 在存在图片时输出 pictures,仅含图片时 content 为空字符串属正常行为

评论数据中存在 pictures 字段,但原始 Comment 类未对其解析,
导致图片评论的 content 为空字符串,图片信息完全丢失。

新增 CommentPicture 数据类,在 Comment 中增加 pictures 字段,
from_dict 解析 pictures 数组,to_dict 在有图片时输出 pictures。

图片评论(如晒 ootd 的回复)现在可正确返回图片尺寸和 CDN URL。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant