summary refs log tree commit diff
diff options
context:
space:
mode:
authorjames <jrabblac@gmail.com>2017-06-17 17:15:41 +0200
committerSergey M․ <dstftw@gmail.com>2017-06-25 01:48:54 +0700
commit449c66577640a0c3f0b383204a1e7284429a61c3 (patch)
treee29e735bb177068fc7139a1c1887481b4fbe459b
parent23aec3d623146d06535a4f5388693c1e9a2bbfde (diff)
downloadyoutube-dl-449c66577640a0c3f0b383204a1e7284429a61c3.tar.gz
youtube-dl-449c66577640a0c3f0b383204a1e7284429a61c3.tar.xz
youtube-dl-449c66577640a0c3f0b383204a1e7284429a61c3.zip
[raiplay:live] Add extractor
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/rai.py19
2 files changed, 19 insertions, 1 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index e97691daa..a263c88b3 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -824,6 +824,7 @@ from .radiobremen import RadioBremenIE
 from .radiofrance import RadioFranceIE
 from .rai import (
     RaiPlayIE,
+    RaiPlayLiveIE,
     RaiIE,
 )
 from .rbmaradio import RBMARadioIE
diff --git a/youtube_dl/extractor/rai.py b/youtube_dl/extractor/rai.py
index 81eb9db85..ed15a5f10 100644
--- a/youtube_dl/extractor/rai.py
+++ b/youtube_dl/extractor/rai.py
@@ -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 = [{