[instagram] fix GraphQL bugs

pull/3003/head
Mike Fährmann 2 years ago
parent 6c76b5f90c
commit e3a03f335c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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)

Loading…
Cancel
Save