From c7372e36cc488d65df76f177b2e4946719cdacf9 Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Sat, 14 Nov 2020 18:57:49 +0100 Subject: [PATCH] Require being logged in for Post.get_likes() Closes #860. --- instaloader/structures.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/instaloader/structures.py b/instaloader/structures.py index 86c00a6..f41bf05 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -437,7 +437,14 @@ class Post: ) def get_likes(self) -> Iterator['Profile']: - """Iterate over all likes of the post. A :class:`Profile` instance of each likee is yielded.""" + """ + Iterate over all likes of the post. A :class:`Profile` instance of each likee is yielded. + + .. versionchanged:: 4.5.4 + Require being logged in (as required by Instagram). + """ + if not self._context.is_logged_in: + raise LoginRequiredException("--login required to access likes of a post.") if self.likes == 0: # Avoid doing additional requests if there are no comments return