From 6b24b54591661a95b469aadf516c03e447958fc1 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 7 May 2019 15:47:52 +0200 Subject: [PATCH] Post properties video_view_count and video_duration Closes #239. --- instaloader/structures.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/instaloader/structures.py b/instaloader/structures.py index 412d1aa..9513212 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -284,6 +284,20 @@ class Post: return self._field('video_url') return None + @property + def video_view_count(self) -> Optional[int]: + """View count of the video, or None.""" + if self.is_video: + return self._field('video_view_count') + return None + + @property + def video_duration(self) -> Optional[float]: + """Duration of the video in seconds, or None.""" + if self.is_video: + return self._field('video_duration') + return None + @property def viewer_has_liked(self) -> Optional[bool]: """Whether the viewer has liked the post, or None if not logged in."""