mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-23 03:02:50 +01:00
[instagram] fix error when PostPage data is not in GraphQL format
(#2037)
This commit is contained in:
parent
4edf43891c
commit
6d190834ee
@ -174,10 +174,16 @@ class InstagramExtractor(Extractor):
|
|||||||
if post.get("is_video") and "video_url" not in post:
|
if post.get("is_video") and "video_url" not in post:
|
||||||
url = "{}/tv/{}/".format(self.root, post["shortcode"])
|
url = "{}/tv/{}/".format(self.root, post["shortcode"])
|
||||||
post = self._extract_post_page(url)
|
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 \
|
elif typename == "GraphSidecar" and \
|
||||||
"edge_sidecar_to_children" not in post:
|
"edge_sidecar_to_children" not in post:
|
||||||
url = "{}/p/{}/".format(self.root, post["shortcode"])
|
url = "{}/p/{}/".format(self.root, post["shortcode"])
|
||||||
post = self._extract_post_page(url)
|
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"]
|
owner = post["owner"]
|
||||||
data = {
|
data = {
|
||||||
@ -347,7 +353,7 @@ class InstagramExtractor(Extractor):
|
|||||||
data = self._extract_shared_data(url)["entry_data"]
|
data = self._extract_shared_data(url)["entry_data"]
|
||||||
if "HttpErrorPage" in data:
|
if "HttpErrorPage" in data:
|
||||||
raise exception.NotFoundError("post")
|
raise exception.NotFoundError("post")
|
||||||
return data["PostPage"][0]["graphql"]["shortcode_media"]
|
return data["PostPage"][0]
|
||||||
|
|
||||||
def _get_edge_data(self, user, key):
|
def _get_edge_data(self, user, key):
|
||||||
cursor = self.config("cursor")
|
cursor = self.config("cursor")
|
||||||
|
Loading…
Reference in New Issue
Block a user