diff options
author | Remita Amine <remitamine@gmail.com> | 2021-02-15 13:06:54 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2021-02-15 13:06:54 +0100 |
commit | 4b5410c5c841b826965ea76d62bea82a26a9e1b8 (patch) | |
tree | 9aaf19616e63de2bde480f4b9dc45a69a6d8badf /youtube_dl | |
parent | be2e9b76eea73b073f00871ea831ee3f4a1000b3 (diff) |
[ccma] fix timestamp parsing in python 2
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/ccma.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/extractor/ccma.py b/youtube_dl/extractor/ccma.py index 4db51e650..e6ae49352 100644 --- a/youtube_dl/extractor/ccma.py +++ b/youtube_dl/extractor/ccma.py @@ -1,12 +1,14 @@ # coding: utf-8 from __future__ import unicode_literals +import calendar import datetime import re from .common import InfoExtractor from ..utils import ( clean_html, + extract_timezone, int_or_none, parse_duration, parse_resolution, @@ -97,8 +99,9 @@ class CCMAIE(InfoExtractor): timestamp = None data_utc = try_get(informacio, lambda x: x['data_emissio']['utc']) try: - timestamp = datetime.datetime.strptime( - data_utc, '%Y-%d-%mT%H:%M:%S%z').timestamp() + timezone, data_utc = extract_timezone(data_utc) + timestamp = calendar.timegm((datetime.datetime.strptime( + data_utc, '%Y-%d-%mT%H:%M:%S') - timezone).timetuple()) except TypeError: pass |