[rte:radio] Extract timestamp
authorSergey M․ <dstftw@gmail.com>
Sun, 3 Jan 2016 23:04:48 +0000 (05:04 +0600)
committerSergey M․ <dstftw@gmail.com>
Sun, 3 Jan 2016 23:04:48 +0000 (05:04 +0600)
youtube_dl/extractor/rte.py

index c17ef2cc2f31dca76b7f56dfb69fcf582089a863..47c8331fed6221ccba38874513cba90ed7d609db 100644 (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,
         }