1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[instagram] fix error when PostPage data is not in GraphQL format

(#2037)
This commit is contained in:
Mike Fährmann 2021-12-28 00:27:59 +01:00
parent 4edf43891c
commit 6d190834ee
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -174,10 +174,16 @@ class InstagramExtractor(Extractor):
if post.get("is_video") and "video_url" not in post:
url = "{}/tv/{}/".format(self.root, post["shortcode"])
post = self._extract_post_page(url)
if "items" in post:
return self._parse_post_api({"media": post["items"][0]})
post = post["graphql"]["shortcode_media"]
elif typename == "GraphSidecar" and \
"edge_sidecar_to_children" not in post:
url = "{}/p/{}/".format(self.root, post["shortcode"])
post = self._extract_post_page(url)
if "items" in post:
return self._parse_post_api({"media": post["items"][0]})
post = post["graphql"]["shortcode_media"]
owner = post["owner"]
data = {
@ -347,7 +353,7 @@ class InstagramExtractor(Extractor):
data = self._extract_shared_data(url)["entry_data"]
if "HttpErrorPage" in data:
raise exception.NotFoundError("post")
return data["PostPage"][0]["graphql"]["shortcode_media"]
return data["PostPage"][0]
def _get_edge_data(self, user, key):
cursor = self.config("cursor")