Add Instagram support to video-link import#90
Merged
Conversation
Wire Instagram reels into the ScrapeCreators client (TikTok was the only implemented platform): - fetchInstagram: GET /v1/instagram/post → shortcode, video_url, caption, and video_duration (seconds → rounded to ms); best-effort transcript via /v2/instagram/media/transcript (often null for reels, falls back to caption + sampled frames). Verified live: the cdninstagram media URL downloads fine from a server (the IP-bound-CDN concern did not pan out). - Control-char sanitizer in the shared get(): Instagram captions contain raw newlines inside JSON strings, which encoding/json rejects. The sanitizer escapes control chars inside string literals and is a no-op on well-formed JSON, so the TikTok path is unchanged (and hardened). Tests: Instagram fetch (fixture carries a real raw-newline caption to prove the sanitizer end-to-end), non-video rejection, and a direct sanitizer unit test. All offline. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends the now-live video-link import (PR #89) to Instagram reels — the platform you asked about. TikTok was the only wired platform; this adds Instagram and the JSON robustness needed for it.
Changes
fetchInstagram—GET /v1/instagram/post→shortcode(cache key),video_url, caption, andvideo_duration(seconds → rounded to ms). Transcript is a best-effortGET /v2/instagram/media/transcript(frequently null for reels; we fall back to caption + sampled frames, which already carry the recipe).get()— Instagram captions contain raw newlines inside JSON string values, whichencoding/jsonrejects (verified:invalid character '\n' in string literal). The sanitizer escapes control chars inside string literals only, so it's a no-op on well-formed JSON and leaves the TikTok path unchanged (just hardened).Verified live (against real ScrapeCreators)
@thecookingfoodiereelDX9a1wjKVRw("Thai mango sticky rice") parsed correctly: shortcode, caption, 22.547s duration, media URL.cdninstagram.commedia URL downloaded fine from a server (HTTP 206,video/mp4) — the feared IP-bound-CDN caveat did not materialize, so nodownload_mediaproxy is needed.Tests (all offline)
TestFetchVideo_Instagram— fixture deliberately embeds a raw-newline caption to prove the sanitizer makes real responses parse end-to-end; asserts shortcode→VideoID, seconds→ms rounding, media URL, transcript.TestFetchVideo_Instagram_NotAVideo— image posts are rejected.TestSanitizeJSONControlChars— raw\n/\tescaped + decode round-trip; already-escaped sequences preserved; clean JSON untouched.Not in this PR
YouTube / Facebook / Pinterest still detect but return "not yet supported" — each needs its own live shape check (YouTube also needs the finished MP4, not the raw googlevideo URL). Follow-ups.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BU4UWZutHd1AnK3XAf7H19