1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 11:12:40 +01:00

[instagram] fix GraphQL bugs

This commit is contained in:
Mike Fährmann 2022-09-30 15:05:29 +02:00
parent 6c76b5f90c
commit e3a03f335c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -868,14 +868,15 @@ class InstagramGraphqlAPI():
url, params=params, headers=headers, cookies=cookies,
).json()["data"]
def _pagination(self, query_hash, variables, key="user", edge=None):
def _pagination(self, query_hash, variables,
key_data="user", key_edge=None):
cursor = self.extractor.config("cursor")
if cursor:
variables["after"] = cursor
while True:
data = self._call(query_hash, variables)[key]
data = data[edge] if edge else next(iter(data.values()))
data = self._call(query_hash, variables)[key_data]
data = data[key_edge] if key_edge else next(iter(data.values()))
for edge in data["edges"]:
yield edge["node"]
@ -889,7 +890,7 @@ class InstagramGraphqlAPI():
"%s'%s posts are private", self.item, s)
variables["after"] = self._cursor = info["end_cursor"]
self.log.debug("Cursor: %s", self._cursor)
self.extractor.log.debug("Cursor: %s", self._cursor)
@cache(maxage=360*24*3600, keyarg=1)