From f85e49d521ca6a838c23213b42acc8c83e9a7e6e Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Wed, 17 Feb 2021 16:31:00 +0100 Subject: [PATCH] Spare unnecessary full metadata fetch This fetch was done for sidecar posts that contain a video when going through a profile. The fetched information is already present with the new profile query introduced in the last commit, making this full metadata fetch query unnecessary. Instaloader now better evaluates if that fetch must be done or not. The fetch was also (eventually unnecessarily) made when accessing get_sidecar_posts() on a Post that has been loaded with load_structure_from_file(). --- instaloader/structures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instaloader/structures.py b/instaloader/structures.py index 9b448ce..ad21ad8 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -273,7 +273,7 @@ class Post: """ if self.typename == 'GraphSidecar': edges = self._field('edge_sidecar_to_children', 'edges') - if any(edge['node']['is_video'] for edge in edges): + if any(edge['node']['is_video'] and 'video_url' not in edge['node'] for edge in edges): # video_url is only present in full metadata, issue #558. edges = self._full_metadata['edge_sidecar_to_children']['edges'] if end < 0: