]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[raiplay:live] Add extractor
authorjames <jrabblac@gmail.com>
Sat, 17 Jun 2017 15:15:41 +0000 (17:15 +0200)
committerSergey M․ <dstftw@gmail.com>
Sat, 24 Jun 2017 18:48:54 +0000 (01:48 +0700)
youtube_dl/extractor/extractors.py
youtube_dl/extractor/rai.py

index e97691daa37c5b0c49d0ac501625c12a5b31c03c..a263c88b36e6fc716c2ce9ef782182ec071b839d 100644 (file)
@@ -824,6 +824,7 @@ from .radiobremen import RadioBremenIE
 from .radiofrance import RadioFranceIE
 from .rai import (
     RaiPlayIE,
+    RaiPlayLiveIE,
     RaiIE,
 )
 from .rbmaradio import RBMARadioIE
index 81eb9db85b9127e292894e22c9dd6272b134832a..ed15a5f10721c38f1f0ead1c8d77997a6a7fbd92 100644 (file)
@@ -208,10 +208,27 @@ class RaiPlayIE(RaiBaseIE):
         }
 
         info.update(relinker_info)
-
         return info
 
 
+class RaiPlayLiveIE(RaiBaseIE):
+    _VALID_URL = r'https?://(?:www\.)?raiplay\.it/dirette/(?P<id>\w*)'
+    _TEST = {
+        'url': 'http://www.raiplay.it/dirette/rai3',
+        'only_matching': True,
+    }
+
+    def _real_extract(self, url):
+        channel = self._match_id(url)
+
+        webpage = self._download_webpage(url, channel)
+        re_id = r'<div([^>]*)data-uniquename=(["\'])[\w-]*(?P<id>%s)(\2)([^>]*?)>' % RaiBaseIE._UUID_RE
+        video_id = self._html_search_regex(re_id, webpage, 'livestream-id', group='id')
+
+        return self.url_result('http://www.raiplay.it/dirette/ContentItem-%s.html' % video_id,
+                               RaiPlayIE.ie_key(), video_id)
+
+
 class RaiIE(RaiBaseIE):
     _VALID_URL = r'https?://[^/]+\.(?:rai\.(?:it|tv)|rainews\.it)/dl/.+?-(?P<id>%s)(?:-.+?)?\.html' % RaiBaseIE._UUID_RE
     _TESTS = [{