1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-12-01 20:57:54 +01:00

[CCMA] Fix wrong timestamp issue

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.
This commit is contained in:
Guillem Vela 2020-02-27 22:18:47 +01:00
parent bee6451fe8
commit 8fbefa5cf7

View File

@ -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', {})