1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 21:54:17 +01:00

dash.parse_date: translate nanoseconds to milliseconds

python cant parse those dates.
This commit is contained in:
Johan Andersson 2021-05-11 00:16:58 +02:00
parent e6379d9a28
commit a5e4166068

View File

@ -294,6 +294,9 @@ def parse_duration(duration):
def parse_dates(date_str): 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"] date_patterns = ["%Y-%m-%dT%H:%M:%S.%fZ", "%Y-%m-%dT%H:%M:%S", "%Y-%m-%dT%H:%M:%SZ"]
dt = None dt = None
for pattern in date_patterns: for pattern in date_patterns: