1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-03 22:07:11 +02:00

Abort the download when redirected to login (#1900)

Abort the download when redirected to login (fixes #1882)
This commit is contained in:
Eduardo Kalinowski 2023-03-30 13:51:27 -03:00 committed by GitHub
parent 6a3d763cf3
commit 2dca99b89e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -335,8 +335,8 @@ class InstaloaderContext:
redirect_url.startswith('https://i.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("Redirected to login")
raise AbortDownloadException("Redirected to login page. You've been logged out, please wait " +
"some time, recreate the session and try again")
if redirect_url.startswith('https://{}/'.format(host)):
resp = sess.get(redirect_url if redirect_url.endswith('/') else redirect_url + '/',
params=params, allow_redirects=False)