Skip to content

feat(reddit): read 命令输出 post_hint / url / preview / gallery 媒体列#1873

Open
huanghe wants to merge 1 commit into
jackwener:mainfrom
huanghe:pr/reddit-read-media-fields
Open

feat(reddit): read 命令输出 post_hint / url / preview / gallery 媒体列#1873
huanghe wants to merge 1 commit into
jackwener:mainfrom
huanghe:pr/reddit-read-media-fields

Conversation

@huanghe
Copy link
Copy Markdown
Contributor

@huanghe huanghe commented Jun 6, 2026

动机

Reddit read 命令此前丢弃了帖子的媒体元数据,调用方无法区分链接帖 / 图片帖 / 相册帖,也拿不到媒体地址。本 PR 在 read 的输出里补上 4 列:

  • post_hint
  • url_overridden_by_dest
  • preview_image_url(从 preview.images[0].source.url 解码 HTML 实体得到)
  • gallery_urls(从 gallery_data / media_metadata 解码得到)

兼容性

纯增量:仅新增列,未改动 type/author/score/text 等既有字段。文本帖在这些字段上回落为空串 / 空数组,行结构保持稳定。cli-manifest.json 已用 npm run build-manifest 重新生成(仅新增这 4 列)。

测试

clis/reddit/read.test.js:18 个用例通过(覆盖 link/image/gallery 帖的字段抽取与文本帖的空值回落)。
npm run check:silent-column-drop → new=0 OK;tsc --noEmit 通过。

The read command dropped Reddit's media metadata. Surface four columns from the
post payload so callers can tell link/image/gallery posts apart and fetch media:

- post_hint
- url_overridden_by_dest
- preview_image_url (decoded from preview.images[0].source.url)
- gallery_urls (decoded from gallery_data / media_metadata)

Empty-string / empty-array fallbacks keep the row shape stable for text posts.
Manifest regenerated.
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