mirror of
https://github.com/instaloader/instaloader.git
synced 2024-08-18 04:39:39 +02:00
Avoid additional http request to get post's owner ID. (#809)
This commit is contained in:
parent
4ad4584b0d
commit
c53625028d
@ -207,7 +207,13 @@ class Post:
|
|||||||
@property
|
@property
|
||||||
def owner_id(self) -> int:
|
def owner_id(self) -> int:
|
||||||
"""The ID of the Post's owner."""
|
"""The ID of the Post's owner."""
|
||||||
return self.owner_profile.userid
|
# The ID may already be available, e.g. if the post instance was created
|
||||||
|
# from an `hashtag.get_posts()` iterator, so no need to make another
|
||||||
|
# http request.
|
||||||
|
if 'owner' in self._node and 'id' in self._node['owner']:
|
||||||
|
return self._node['owner']['id']
|
||||||
|
else:
|
||||||
|
return self.owner_profile.userid
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def date_local(self) -> datetime:
|
def date_local(self) -> datetime:
|
||||||
|
Loading…
Reference in New Issue
Block a user