From 43c521afa90df0cd1374814f25b765f90fb9f318 Mon Sep 17 00:00:00 2001 From: 17it151tejaschauhan <73033393+17it151tejaschauhan@users.noreply.github.com> Date: Sat, 16 Jan 2021 23:20:27 +0530 Subject: [PATCH] Add method to get title of post (#976) Co-authored-by: Tejas Chauhan Co-authored-by: Alexander Graf <17130992+aandergr@users.noreply.github.com> --- instaloader/structures.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/instaloader/structures.py b/instaloader/structures.py index 045d636..1a64584 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -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 ''.format(self.shortcode)