From 34416298a0851e81c2779f95ae456d409f1c8d4b Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 24 Jan 2019 22:40:36 +0100 Subject: [PATCH] profiles: First load profilepic, then save json This way, the iphone_struct information is included in saved profile pictures. --- instaloader/instaloader.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/instaloader/instaloader.py b/instaloader/instaloader.py index 99db1b0..5c4c65e 100644 --- a/instaloader/instaloader.py +++ b/instaloader/instaloader.py @@ -898,6 +898,11 @@ class Instaloader: with error_handler(profile.username): profile_name = profile.username + # Download profile picture + if profile_pic: + with self.context.error_catcher('Download profile picture of {}'.format(profile_name)): + self.download_profilepic(profile) + # Save metadata as JSON if desired. if self.save_metadata: json_filename = '{0}/{1}_{2}'.format(self.dirname_pattern.format(profile=profile_name, @@ -905,11 +910,6 @@ class Instaloader: profile_name, profile.userid) self.save_metadata_json(json_filename, profile) - # Download profile picture - if profile_pic: - with self.context.error_catcher('Download profile picture of {}'.format(profile_name)): - self.download_profilepic(profile) - # Catch some errors if profile.is_private and (tagged or highlights or posts): if not self.context.is_logged_in: