From cc2986cff3d9212682b8db333acf6bbae265b467 Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Sat, 14 Nov 2020 19:53:43 +0100 Subject: [PATCH] Fix Hashtag.get_all_posts() missing one post in certain cases When a hashtag query returned only the 9 top posts, get_all_posts() yielded only 8 instead of all 9 posts. Closes #853. --- instaloader/structures.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/instaloader/structures.py b/instaloader/structures.py index f41bf05..3dd31ef 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -1359,9 +1359,13 @@ class Hashtag: next_other = next(other_posts, None) while next_top is not None or next_other is not None: if next_other is None: + assert next_top is not None + yield next_top yield from sorted_top_posts break if next_top is None: + assert next_other is not None + yield next_other yield from other_posts break if next_top == next_other: