From 9938a17f92ad8242d8841528a89df647ff759183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergey=20M=E2=80=A4?= Date: Mon, 4 Jan 2016 05:04:48 +0600 Subject: [PATCH] [rte:radio] Extract timestamp --- youtube_dl/extractor/rte.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/rte.py b/youtube_dl/extractor/rte.py index c17ef2cc2..47c8331fe 100644 --- a/youtube_dl/extractor/rte.py +++ b/youtube_dl/extractor/rte.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( float_or_none, + parse_iso8601, unescapeHTML, ) @@ -69,10 +70,12 @@ class RteRadioIE(InfoExtractor): 'url': 'http://www.rte.ie/radio/utils/radioplayer/rteradioweb.html#!rii=16:10507902:2414:27-12-2015:', 'info_dict': { 'id': '10507902', - 'ext': 'flv', + 'ext': 'mp4', 'title': 'Gloria', 'thumbnail': 're:^https?://.*\.jpg$', - 'description': 'Tim Thurston guides you through a millennium of sacred music featuring Gregorian chant, pure solo voices and choral masterpieces, framed around the glorious music of J.S. Bach.', + 'description': 'md5:9ce124a7fb41559ec68f06387cabddf0', + 'timestamp': 1451203200, + 'upload_date': '20151227', 'duration': 7230.0, }, 'params': { @@ -82,8 +85,10 @@ class RteRadioIE(InfoExtractor): def _real_extract(self, url): item_id = self._match_id(url) - feeds_url = 'http://www.rte.ie/rteavgen/getplaylist/?type=web&format=json&id=' + item_id - json_string = self._download_json(feeds_url, item_id) + + json_string = self._download_json( + 'http://www.rte.ie/rteavgen/getplaylist/?type=web&format=json&id=' + item_id, + item_id) # NB the string values in the JSON are stored using XML escaping(!) show = json_string['shows'][0] @@ -91,6 +96,7 @@ class RteRadioIE(InfoExtractor): description = unescapeHTML(show.get('description')) thumbnail = show.get('thumbnail') duration = float_or_none(show.get('duration'), 1000) + timestamp = parse_iso8601(show.get('published')) mg = show['media:group'][0] @@ -114,8 +120,9 @@ class RteRadioIE(InfoExtractor): return { 'id': item_id, 'title': title, - 'formats': formats, 'description': description, 'thumbnail': thumbnail, + 'timestamp': timestamp, 'duration': duration, + 'formats': formats, }