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

Fix bug concerning Story class

This commit is contained in:
André Koch-Kramer 2018-04-12 16:57:46 +02:00
parent 9b3014d5bf
commit bd9e9d4a06
2 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -618,6 +618,7 @@ class Story:
self._context = context
self._node = node
self._unique_id = None
self._owner_profile = None
def __repr__(self):
return '<Story by {} changed {:%Y-%m-%d_%H-%M-%S_UTC}>'.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: