Have PrivateProfileNotFollowedException
This commit is contained in:
parent
b57ccc049b
commit
37a316583a
@ -16,6 +16,9 @@ class ProfileNotExistsException(DownloaderException):
|
|||||||
class ProfileHasNoPicsException(DownloaderException):
|
class ProfileHasNoPicsException(DownloaderException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class PrivateProfileNotFollowedException(DownloaderException):
|
||||||
|
pass
|
||||||
|
|
||||||
class LoginRequiredException(DownloaderException):
|
class LoginRequiredException(DownloaderException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -227,6 +230,8 @@ def download(name, username = None, password = None, sessionfile = None, \
|
|||||||
if not status:
|
if not status:
|
||||||
raise DownloaderException("aborting due to login error")
|
raise DownloaderException("aborting due to login error")
|
||||||
data = get_json(name, session=session)
|
data = get_json(name, session=session)
|
||||||
|
if not data["entry_data"]["ProfilePage"][0]["user"]["followed_by_viewer"]:
|
||||||
|
raise PrivateProfileNotFollowedException("user %s: private but not followed" % name)
|
||||||
if ("nodes" not in data["entry_data"]["ProfilePage"][0]["user"]["media"] \
|
if ("nodes" not in data["entry_data"]["ProfilePage"][0]["user"]["media"] \
|
||||||
or len(data["entry_data"]["ProfilePage"][0]["user"]["media"]["nodes"]) == 0) \
|
or len(data["entry_data"]["ProfilePage"][0]["user"]["media"]["nodes"]) == 0) \
|
||||||
and not profile_pic_only:
|
and not profile_pic_only:
|
||||||
@ -289,7 +294,7 @@ def main():
|
|||||||
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,
|
except (ProfileNotExistsException, ProfileHasNoPicsException,
|
||||||
LoginRequiredException) as err:
|
PrivateProfileNotFollowedException, 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:
|
||||||
|
Loading…
Reference in New Issue
Block a user