From bd9e9d4a064e95afd017637cdb906a104c1ebaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Koch-Kramer?= Date: Thu, 12 Apr 2018 16:57:46 +0200 Subject: [PATCH] Fix bug concerning Story class --- instaloader/__init__.py | 2 +- instaloader/structures.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/instaloader/__init__.py b/instaloader/__init__.py index 5dd58e2..eed35c9 100644 --- a/instaloader/__init__.py +++ b/instaloader/__init__.py @@ -14,4 +14,4 @@ else: from .exceptions import * from .instaloader import Instaloader, Tristate -from .structures import Post, Profile, shortcode_to_mediaid, mediaid_to_shortcode +from .structures import Post, Profile, Story, StoryItem, shortcode_to_mediaid, mediaid_to_shortcode diff --git a/instaloader/structures.py b/instaloader/structures.py index 910177f..68c1262 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -618,6 +618,7 @@ class Story: self._context = context self._node = node self._unique_id = None + self._owner_profile = None def __repr__(self): return ''.format(self.owner_username, self.latest_media_utc) @@ -672,7 +673,9 @@ class Story: @property def owner_profile(self) -> Profile: """:class:`Profile` instance of the story owner.""" - return Profile(self._context, self._node['user']) + if not self._owner_profile: + self._owner_profile = Profile(self._context, self._node['user']) + return self._owner_profile @property def owner_username(self) -> str: