← Back to PRs

#21786: feat(feishu): extract embedded video/media from post (rich text) messages

by laopuhuluwa open 2026-02-20 11:05 View on GitHub →
channel: feishu size: S
## Summary Feishu post (rich text) messages can contain embedded videos and audio via `<media>` tags, but `parsePostContent()` only extracted `<img>` tags. This meant embedded videos in rich text posts were silently dropped — the agent never received them. ## Problem When a user sends a rich text message with an embedded video (common in Feishu — the editor allows dragging videos into posts), the message is received as `message_type: 'post'` with content like: ```json {"content": [[{"tag": "media", "file_key": "file_v3_xxx", "file_name": "video.mov"}]]} ``` The existing `parsePostContent()` only looked for `img` tags, so this media was ignored. ## Changes ### `parsePostContent()` - Now also extracts `media` tags (embedded video/audio) with their `file_key` and optional `file_name` - Returns new `mediaKeys: Array<{ fileKey: string; fileName?: string }>` alongside existing `imageKeys` ### `resolveFeishuMediaList()` - After downloading embedded images, now also downloads embedded media files from posts - Uses `messageResource` API with `type: 'file'` for media downloads - Adds logging for media discovery and download ## Testing - Build passes (`pnpm build`) - Lint passes (`pnpm lint`, 0 warnings 0 errors) - Tested with real Feishu post messages containing embedded .MOV video files <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds support for extracting embedded video/audio files from Feishu rich text (post) messages. Previously, `parsePostContent()` only extracted `<img>` tags, silently dropping `<media>` tags containing videos/audio. This change: - Extends `parsePostContent()` to collect both image keys and media keys (file_key + optional file_name) from post content - Updates `resolveFeishuMediaList()` to download embedded media files using the `messageResource` API with `type: 'file'` - Adds appropriate logging for media discovery and downloads The implementation follows the existing pattern for embedded images and correctly uses the `messageResource` API for downloading files from messages. <h3>Confidence Score: 4/5</h3> - Safe to merge with one minor type inconsistency - The implementation correctly mirrors the existing embedded image handling pattern and properly uses the Feishu messageResource API. The change is well-tested according to the PR description. One minor type inconsistency exists where `fileName` is added to the media info object but not defined in the `FeishuMediaInfo` type - however, this doesn't affect runtime behavior since the property is not used downstream. - No files require special attention <sub>Last reviewed commit: c3ef915</sub> <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs