diff --git a/instaloader/__init__.py b/instaloader/__init__.py index 6d4e90a..155722f 100644 --- a/instaloader/__init__.py +++ b/instaloader/__init__.py @@ -1,7 +1,7 @@ """Download pictures (or videos) along with their captions and other metadata from Instagram.""" -__version__ = '4.5.4' +__version__ = '4.5.5' try: diff --git a/instaloader/__main__.py b/instaloader/__main__.py index 31d6058..0f7a1e1 100644 --- a/instaloader/__main__.py +++ b/instaloader/__main__.py @@ -222,14 +222,13 @@ def _main(instaloader: Instaloader, targetlist: List[str], # Instaloader did at least save a session file instaloader.context.log("No targets were specified, thus nothing has been downloaded.") else: - # Instloader did not do anything + # Instaloader did not do anything instaloader.context.log("usage:" + usage_string()) def main(): parser = ArgumentParser(description=__doc__, add_help=False, usage=usage_string(), - epilog="Report issues at https://github.com/instaloader/instaloader/issues. " - "The complete documentation can be found at " + epilog="The complete documentation can be found at " "https://instaloader.github.io/.", fromfile_prefix_chars='+') diff --git a/instaloader/instaloadercontext.py b/instaloader/instaloadercontext.py index e863c21..1407e80 100644 --- a/instaloader/instaloadercontext.py +++ b/instaloader/instaloadercontext.py @@ -320,8 +320,10 @@ class InstaloaderContext: redirect_url = resp.headers['location'] self.log('\nHTTP redirect from https://{0}/{1} to {2}'.format(host, path, redirect_url)) if redirect_url.startswith('https://www.instagram.com/accounts/login'): + if not self.is_logged_in: + raise LoginRequiredException("Redirected to login page. Use --login.") # alternate rate limit exceeded behavior - raise TooManyRequestsException("429 Too Many Requests: redirected to login") + raise TooManyRequestsException("Redirected to login") if redirect_url.startswith('https://{}/'.format(host)): resp = sess.get(redirect_url if redirect_url.endswith('/') else redirect_url + '/', params=params, allow_redirects=False) diff --git a/instaloader/nodeiterator.py b/instaloader/nodeiterator.py index c72fe46..7fbe154 100644 --- a/instaloader/nodeiterator.py +++ b/instaloader/nodeiterator.py @@ -263,7 +263,8 @@ def resumable_iteration(context: InstaloaderContext, try: yield is_resuming, start_index except KeyboardInterrupt: - os.makedirs(os.path.dirname(resume_file_path), exist_ok=True) + if os.path.dirname(resume_file_path): + os.makedirs(os.path.dirname(resume_file_path), exist_ok=True) save(iterator.freeze(), resume_file_path) context.log("\nSaved resume information to {}.".format(resume_file_path)) raise diff --git a/instaloader/structures.py b/instaloader/structures.py index ffa54c8..97face0 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -1114,14 +1114,14 @@ class Story: @property def last_seen_local(self) -> Optional[datetime]: - """Timestamp when the story has last been watched or None (local time zone).""" + """Timestamp of the most recent StoryItem that has been watched or None (local time zone).""" if self._node['seen']: return datetime.fromtimestamp(self._node['seen']) return None @property def last_seen_utc(self) -> Optional[datetime]: - """Timestamp when the story has last been watched or None (UTC).""" + """Timestamp of the most recent StoryItem that has been watched or None (UTC).""" if self._node['seen']: return datetime.utcfromtimestamp(self._node['seen']) return None