[instagram] prevent crash on empty user profile

This commit is contained in:
Mike Fährmann
2022-10-05 20:02:20 +02:00
parent b57015cf0a
commit 36afb519b3

View File

@@ -702,6 +702,9 @@ class InstagramRestAPI():
if screen_name.startswith("id:"):
return screen_name[3:]
user = self.user(screen_name)
if user is None:
raise exception.AuthorizationError(
"Login required to access this profile")
if user["is_private"] and not user["followed_by_viewer"]:
name = user["username"]
s = "" if name.endswith("s") else "s"