1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-08-19 05:09:39 +02:00

Add method to get title of post (#976)

Co-authored-by: Tejas Chauhan <tejas.chauhan@kevit.io>
Co-authored-by: Alexander Graf <17130992+aandergr@users.noreply.github.com>
This commit is contained in:
17it151tejaschauhan 2021-01-16 23:20:27 +05:30 committed by GitHub
parent 3955540080
commit 43c521afa9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,6 +128,14 @@ class Post:
"""The mediaid is a decimal representation of the media shortcode."""
return int(self._node['id'])
@property
def title(self) -> Optional[str]:
"""Title of post"""
try:
return self._field('title')
except KeyError:
return None
def __repr__(self):
return '<Post {}>'.format(self.shortcode)