From 8fbefa5cf7c418f4aaccb4e4b08b7660f0549954 Mon Sep 17 00:00:00 2001 From: Guillem Vela Date: Thu, 27 Feb 2020 22:18:47 +0100 Subject: [PATCH] [CCMA] Fix wrong timestamp issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason, provided UTC timestamp does not comply ISO8601, as its format is YYYY-DD-MM instead of expected YYYY-MM-DD. This can be checked with the also provided "text" field of emission date object. Example: "data_emissio": { "text": "14/05/2002�21:39", "utc": "2002-14-05T21:39:28+0200" } This commit fixes this behavior. --- youtube_dl/extractor/ccma.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/ccma.py b/youtube_dl/extractor/ccma.py index 544647f92..6a955da84 100644 --- a/youtube_dl/extractor/ccma.py +++ b/youtube_dl/extractor/ccma.py @@ -24,8 +24,8 @@ class CCMAIE(InfoExtractor): 'ext': 'mp4', 'title': 'L\'espot de La Marató de TV3', 'description': 'md5:f12987f320e2f6e988e9908e4fe97765', - 'timestamp': 1470918540, - 'upload_date': '20160811', + 'timestamp': 1478608140, + 'upload_date': '20161108', } }, { 'url': 'http://www.ccma.cat/catradio/alacarta/programa/el-consell-de-savis-analitza-el-derbi/audio/943685/', @@ -35,8 +35,8 @@ class CCMAIE(InfoExtractor): 'ext': 'mp3', 'title': 'El Consell de Savis analitza el derbi', 'description': 'md5:e2a3648145f3241cb9c6b4b624033e53', - 'upload_date': '20171205', - 'timestamp': 1512507300, + 'upload_date': '20170512', + 'timestamp': 1494622500, } }] @@ -74,7 +74,11 @@ class CCMAIE(InfoExtractor): title = informacio['titol'] durada = informacio.get('durada', {}) duration = int_or_none(durada.get('milisegons'), 1000) or parse_duration(durada.get('text')) - timestamp = parse_iso8601(informacio.get('data_emissio', {}).get('utc')) + + # utc date is in format YYYY-DD-MM + data_utc = informacio.get('data_emissio', {}).get('utc') + data_iso8601 = data_utc[:5] + data_utc[8:10] + '-' + data_utc[5:7] + data_utc[10:] + timestamp = parse_iso8601(data_iso8601) subtitles = {} subtitols = media.get('subtitols', {})