Skip to content

fix(instagram): preview a copyright-blocked video with its cover frame - #14

Merged
musingfox merged 1 commit into
mainfrom
fix/instagram-blocked-reel-cover
Oct 23, 2026
Merged

musingfox merged 1 commit into
mainfrom
fix/instagram-blocked-reel-cover

Conversation

@musingfox

@musingfox musingfox commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Problem

Share links for copyright-blocked Instagram reels (e.g. /www.instagram.com/reel/Dey7uKIB2oP/) got no preview in Telegram. The embed page carries WatchOnInstagram and copyright_blocked: true and has no video_url, so parseEmbed returned null and the crawler was sent to instagram.com, which gives Telegram nothing.

Change

  • parseEmbed turns a blocked GraphVideo into an image post built from the embed's cover frame (EmbeddedMediaImage), author and caption.
  • Blocked carousels, blocked videos without a cover frame, and image posts that only show WatchOnInstagram still return null and 302.
  • docs/spec/fail-open-to-original.md now lists the cover-frame fallback and the remaining failure signals.

Verification

  • bun run check passes (629 tests).
  • Ran cf dev locally with a Telegram UA on the reported reel: the share link returned 200 with og:image pointing at /media/Dey7uKIB2oP/1 and no og:video. /media/Dey7uKIB2oP/1 returned 302 to scontent.cdninstagram.com with no-store, and that image came back as 200 image/jpeg.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 錯誤修正
    • Instagram 圖片貼文即使顯示「在 Instagram 上觀看」,只要能取得圖片,仍可正常顯示。
    • 受版權限制的影片若有封面圖,會以封面圖呈現,不再一律導向原始貼文。
    • 多圖貼文遇到版權封鎖訊號,或受限影片缺少封面圖時,仍會導向原始貼文。

Instagram drops video_url from the embed of a copyright-blocked video, so
the share link fell back to a 302 and Telegram showed no preview. The embed
still carries the cover frame, author and caption, so render those as an
image post instead. Blocked carousels and blocked videos without a cover
frame still redirect to the original.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between c427bfa and 28b69d9.

📒 Files selected for processing: 4
  • docs/spec/fail-open-to-original.md
  • src/instagram.ts
  • test/fail-open-to-original.test.ts
  • test/instagram.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Instagram 嵌入解析新增封面影格圖片回退,並依媒體類型及封鎖訊號處理貼文。測試與規格更新有封面影格和缺少封面影格時的回應。

Changes: Instagram 封面影格回退

Layer / File(s) Summary
嵌入解析與封面影格回退
src/instagram.ts, test/instagram.test.ts
parseEmbed 不再一律因 WatchOnInstagram 標記或版權封鎖而回傳無貼文。符合條件的 GraphVideo 會使用封面影格建立圖片貼文;GraphSidecar 仍回傳無貼文。測試涵蓋圖片、影片、輪播及缺少封面影格的情境。
失敗處理回應與規格
test/fail-open-to-original.test.ts, docs/spec/fail-open-to-original.md
有封面影格的版權封鎖影片會回傳 200 HTML 頁面,使用 og:image 且不包含 og:video。缺少可辨識封面影格時會重新導向。規格文件補充這些判定情境。

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 28b69

Covered blocked reels can show a cover preview, while image posts showing only the Instagram marker still redirect. No merge-blocking issue is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 標題準確描述主要變更:使用封面影像預覽受版權封鎖的 Instagram 影片。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@musingfox
musingfox merged commit 0dbbe7e into main Oct 23, 2026
2 checks passed
@musingfox
musingfox deleted the fix/instagram-blocked-reel-cover branch October 23, 2026 04:43
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