1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-09-11 16:22:24 +02:00

Do not abort when login is required in quiet mode

An error message is still printed.

This fixes #2.
This commit is contained in:
Alexander Graf 2016-07-15 15:54:35 +02:00
parent 51822eaa66
commit b57ccc049b

View File

@ -16,6 +16,9 @@ class ProfileNotExistsException(DownloaderException):
class ProfileHasNoPicsException(DownloaderException): class ProfileHasNoPicsException(DownloaderException):
pass pass
class LoginRequiredException(DownloaderException):
pass
def log(*msg, sep='', end='\n', flush=False, quiet=False): def log(*msg, sep='', end='\n', flush=False, quiet=False):
if not quiet: if not quiet:
print(*msg, sep=sep, end=end, flush=flush) print(*msg, sep=sep, end=end, flush=flush)
@ -207,8 +210,7 @@ def download(name, username = None, password = None, sessionfile = None, \
if not test_login(username, session): if not test_login(username, session):
if username is None or password is None: if username is None or password is None:
if quiet: if quiet:
raise DownloaderException('Login required, credentials not given, ' \ raise LoginRequiredException("user %s requires login" % name)
'operating in quiet mode')
while True: while True:
if username is None: if username is None:
username = input('Enter your Instagram username to login: ') username = input('Enter your Instagram username to login: ')
@ -286,7 +288,8 @@ def main():
username = download(target, username, args.password, args.sessionfile, username = download(target, username, args.password, args.sessionfile,
args.profile_pic_only, not args.skip_videos, args.fast_update, args.profile_pic_only, not args.skip_videos, args.fast_update,
[0,0] if args.no_sleep else [0.25,2], args.quiet) [0,0] if args.no_sleep else [0.25,2], args.quiet)
except (ProfileNotExistsException, ProfileHasNoPicsException) as err: except (ProfileNotExistsException, ProfileHasNoPicsException,
LoginRequiredException) as err:
failedtargets.append(target) failedtargets.append(target)
print("%s" % err, file=sys.stderr) print("%s" % err, file=sys.stderr)
if len(args.targets) > 1 and len(failedtargets) > 0: if len(args.targets) > 1 and len(failedtargets) > 0: