[rte:radio] Extract timestamp

pull/7218/merge
Sergey M․ 9 years ago
parent 9746f4314a
commit 9938a17f92

@ -4,6 +4,7 @@ from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ( from ..utils import (
float_or_none, float_or_none,
parse_iso8601,
unescapeHTML, 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:', 'url': 'http://www.rte.ie/radio/utils/radioplayer/rteradioweb.html#!rii=16:10507902:2414:27-12-2015:',
'info_dict': { 'info_dict': {
'id': '10507902', 'id': '10507902',
'ext': 'flv', 'ext': 'mp4',
'title': 'Gloria', 'title': 'Gloria',
'thumbnail': 're:^https?://.*\.jpg$', '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, 'duration': 7230.0,
}, },
'params': { 'params': {
@ -82,8 +85,10 @@ class RteRadioIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
item_id = self._match_id(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(!) # NB the string values in the JSON are stored using XML escaping(!)
show = json_string['shows'][0] show = json_string['shows'][0]
@ -91,6 +96,7 @@ class RteRadioIE(InfoExtractor):
description = unescapeHTML(show.get('description')) description = unescapeHTML(show.get('description'))
thumbnail = show.get('thumbnail') thumbnail = show.get('thumbnail')
duration = float_or_none(show.get('duration'), 1000) duration = float_or_none(show.get('duration'), 1000)
timestamp = parse_iso8601(show.get('published'))
mg = show['media:group'][0] mg = show['media:group'][0]
@ -114,8 +120,9 @@ class RteRadioIE(InfoExtractor):
return { return {
'id': item_id, 'id': item_id,
'title': title, 'title': title,
'formats': formats,
'description': description, 'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'timestamp': timestamp,
'duration': duration, 'duration': duration,
'formats': formats,
} }

Loading…
Cancel
Save