From 67ac8f339716c498cddb2f1489eac6104409646c Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 10 Apr 2018 20:52:39 +0200 Subject: [PATCH] Enforce being logged in for getting username by id It seems it is not possible at the moment to get username by userid anonymously. --- instaloader.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instaloader.py b/instaloader.py index 5db413f..adc6a81 100755 --- a/instaloader.py +++ b/instaloader.py @@ -1373,6 +1373,9 @@ class Instaloader: self._log("Profile {0} does not match the stored unique ID {1}.".format(profile, profile_id)) else: self._log("Trying to find profile {0} using its unique ID {1}.".format(profile, profile_id)) + if not self.is_logged_in: + self.error("Profile {} changed its name. If you use --login=USERNAME, I can find out the new name.") + raise LoginRequiredException("Login required to obtain username from userid") newname = self.get_username_by_id(profile_id) self._log("Profile {0} has changed its name to {1}.".format(profile, newname)) if ((format_string_contains_key(self.dirname_pattern, 'profile') or