[rte:radio] Extract timestamp

This commit is contained in:
Sergey M․ 2016-01-04 05:04:48 +06:00
parent 9746f4314a
commit 9938a17f92
1 changed files with 12 additions and 5 deletions

View File

@ -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,
}