From 6cbc434b54e285d901f6e0a9c3682175facc368b Mon Sep 17 00:00:00 2001 From: ActuallyKit <54536660+ActuallyKit@users.noreply.github.com> Date: Sun, 9 Jul 2023 02:28:35 +0700 Subject: [PATCH 1/4] Fix users pagination --- gallery_dl/extractor/twitter.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index c0b4ab61..8cf8f194 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -1762,9 +1762,8 @@ class TwitterAPI(): yield user elif entry["entryId"].startswith("cursor-bottom-"): cursor = entry["content"]["value"] - elif instr["type"] == "TimelineTerminateTimeline": - if instr["direction"] == "Bottom": - stop = True + if (cursor.startswith("-1|") or cursor.startswith("0|")): + stop = True if stop or not cursor or not entry: return From a437a34bcf925243edee0f43e5cc86b11e1610b4 Mon Sep 17 00:00:00 2001 From: ActuallyKit <54536660+ActuallyKit@users.noreply.github.com> Date: Sun, 9 Jul 2023 02:41:46 +0700 Subject: [PATCH 2/4] fix lint i guess? --- gallery_dl/extractor/twitter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index 8cf8f194..420212a1 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -1762,7 +1762,9 @@ class TwitterAPI(): yield user elif entry["entryId"].startswith("cursor-bottom-"): cursor = entry["content"]["value"] - if (cursor.startswith("-1|") or cursor.startswith("0|")): + if (cursor.startswith("-1|")): + stop = True + if (cursor.startswith("0|")): stop = True if stop or not cursor or not entry: From c321c773f2cbc8cd1cb4ced405c7abcbac705b96 Mon Sep 17 00:00:00 2001 From: ActuallyKit <54536660+ActuallyKit@users.noreply.github.com> Date: Sun, 9 Jul 2023 02:52:04 +0700 Subject: [PATCH 3/4] make the code less ugly --- gallery_dl/extractor/twitter.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index 420212a1..ff2e858c 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -1762,9 +1762,8 @@ class TwitterAPI(): yield user elif entry["entryId"].startswith("cursor-bottom-"): cursor = entry["content"]["value"] - if (cursor.startswith("-1|")): - stop = True - if (cursor.startswith("0|")): + if cursor.startswith("-1|") or \ + cursor.startswith("0|"): stop = True if stop or not cursor or not entry: From f6553ffd2f2fb515be35c50dae4e303fa252a954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 10 Jul 2023 14:39:09 +0200 Subject: [PATCH 4/4] [twitter] simplify '_pagination_users' - remove 'stop' variable - call 'cursor.startswith()' only once --- gallery_dl/extractor/twitter.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gallery_dl/extractor/twitter.py b/gallery_dl/extractor/twitter.py index ff2e858c..2183fdc5 100644 --- a/gallery_dl/extractor/twitter.py +++ b/gallery_dl/extractor/twitter.py @@ -1733,7 +1733,7 @@ class TwitterAPI(): "features" : self._json_dumps(self.features_pagination)} while True: - cursor = entry = stop = None + cursor = entry = None params["variables"] = self._json_dumps(variables) data = self._call(endpoint, params)["data"] @@ -1762,11 +1762,8 @@ class TwitterAPI(): yield user elif entry["entryId"].startswith("cursor-bottom-"): cursor = entry["content"]["value"] - if cursor.startswith("-1|") or \ - cursor.startswith("0|"): - stop = True - if stop or not cursor or not entry: + if not cursor or cursor.startswith(("-1|", "0|")) or not entry: return variables["cursor"] = cursor