From a5e416606801d0ea03dd3d19cd78848aaa41efca Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 11 May 2021 00:16:58 +0200 Subject: [PATCH] dash.parse_date: translate nanoseconds to milliseconds python cant parse those dates. --- lib/svtplay_dl/fetcher/dash.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/svtplay_dl/fetcher/dash.py b/lib/svtplay_dl/fetcher/dash.py index d655c3a..e87482a 100644 --- a/lib/svtplay_dl/fetcher/dash.py +++ b/lib/svtplay_dl/fetcher/dash.py @@ -294,6 +294,9 @@ def parse_duration(duration): def parse_dates(date_str): + match = re.search(r"(.*:.*)\.(\d{9})Z", date_str) + if match: + date_str = f"{match.group(1)}.{int(int(match.group(2))/1000)}Z" # Need to translate nanoseconds to milliseconds date_patterns = ["%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%dT%H:%M:%SZ"] dt = None for pattern in date_patterns: