Skip to content

Commit

Permalink
[instagram] fetch media for incomplete GraphSidecar posts
Browse files Browse the repository at this point in the history
GraphSidecar results from /tagged pages don't contain
all media elements, only the first one.

(#1439)
  • Loading branch information
mikf committed Apr 8, 2021
1 parent b0686d2 commit b869b3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gallery_dl/extractor/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,18 @@ def _login_impl(self, username, password):
}

def _parse_post_graphql(self, post):
typename = post["__typename"]
if post.get("is_video") and "video_url" not in post:
url = "{}/tv/{}/".format(self.root, post["shortcode"])
post = self._extract_post_page(url)
elif typename == "GraphSidecar" and \
"edge_sidecar_to_children" not in post:
url = "{}/p/{}/".format(self.root, post["shortcode"])
post = self._extract_post_page(url)

owner = post["owner"]
data = {
"typename" : post["__typename"],
"typename" : typename,
"date" : text.parse_timestamp(post["taken_at_timestamp"]),
"likes" : post["edge_media_preview_like"]["count"],
"owner_id" : owner["id"],
Expand Down

0 comments on commit b869b3a

Please sign in to comment.