From d611aa1e143ac0e1b8a8f688eaa1e7012f42c69f Mon Sep 17 00:00:00 2001 From: Logan Williams Date: Fri, 18 Mar 2022 09:44:17 +0100 Subject: [PATCH] Some videos don't render a duration for some reason --- archivers/telegram_archiver.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/archivers/telegram_archiver.py b/archivers/telegram_archiver.py index 9e735bb..61f56d0 100644 --- a/archivers/telegram_archiver.py +++ b/archivers/telegram_archiver.py @@ -69,12 +69,15 @@ class TelegramArchiver(Archiver): hash = self.get_hash(filename) # extract duration from HTML - duration = s.find_all('time')[0].contents[0] - if ':' in duration: - duration = float(duration.split( - ':')[0]) * 60 + float(duration.split(':')[1]) - else: - duration = float(duration) + try: + duration = s.find_all('time')[0].contents[0] + if ':' in duration: + duration = float(duration.split( + ':')[0]) * 60 + float(duration.split(':')[1]) + else: + duration = float(duration) + except: + duration = "" # process thumbnails key_thumb, thumb_index = self.get_thumbnails(