From ed55ce140df608b972419b3fb351560aba299f3a Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Sat, 12 Dec 2020 16:49:38 +0100 Subject: [PATCH] Fix efficiency bug in download_profiles() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes efficiency of the download_profiles() function when called with --no-posts --no-profile-pic by reordering an if statement. This inefficiency has been reported in #724. Co-authored-by: André Koch-Kramer --- instaloader/instaloader.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/instaloader/instaloader.py b/instaloader/instaloader.py index 6022d3e..d89b37a 100644 --- a/instaloader/instaloader.py +++ b/instaloader/instaloader.py @@ -1129,10 +1129,13 @@ class Instaloader: self.save_metadata_json(json_filename, profile) # Catch some errors - if profile.is_private and (tagged or igtv or highlights or posts): - if not self.context.is_logged_in: + if tagged or igtv or highlights or posts: + if (not self.context.is_logged_in and + profile.is_private): raise LoginRequiredException("--login=USERNAME required.") - if not profile.followed_by_viewer and self.context.username != profile.username: + if (self.context.username != profile.username and + profile.is_private and + not profile.followed_by_viewer): raise PrivateProfileNotFollowedException("Private but not followed.") # Download tagged, if requested