fix: handle sidecar children without __typename in embed fallback - #44
Open
atsetilam wants to merge 1 commit into
Open
fix: handle sidecar children without __typename in embed fallback#44atsetilam wants to merge 1 commit into
atsetilam wants to merge 1 commit into
Conversation
The embed-page extraction path (GetEmbedMedia) returns edge_sidecar_to_children nodes without a __typename field (unlike the GQL API), using an is_video boolean instead. The sidecar-parsing switch only matched on Typename, so any carousel post resolved via the embed fallback got items with zero formats, failing downstream with "no formats found for media item at index N" even though the post is public and available.
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.
Summary
GetEmbedMedia→ParseGQLMedia'sGraphSidecarbranch) failed to extract any media for Instagram carousel posts whenever the GQL API method failed first and it fell back to scraping the embed page.__typenameonedge_sidecar_to_childrennodes entirely (unlike the GQL API response), using anis_videoboolean instead. The existing switch only matched onTypename, so every sidecar child resolved via the embed fallback ended up with zero formats attached, and the download later failed withno formats found for media item at index N— even though the post was public and available.node.IsVideowhenTypenamedoesn't match either known value (GraphVideo/XDTGraphVideoorGraphImage/XDTGraphImage), sinceis_videois present on every variant of the response.Confirmed working against a live public carousel post that previously reproduced the bug 100% of the time.
Test plan
go build ./...