aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/rai.py
diff options
context:
space:
mode:
authorTimendum <timedum@gmail.com>2017-10-23 15:32:45 +0200
committerSergey M․ <dstftw@gmail.com>2017-12-09 00:47:40 +0700
commitd21d0ba6c14e8a6696130090641da4e2028e1bb3 (patch)
tree578e53dd3f06be0fa6ffd2508ed1d09e3a9fa92c /youtube_dl/extractor/rai.py
parenta670b1ba266533c520a436469585904321808a1b (diff)
[raiplay:playlist] Add extractor
Diffstat (limited to 'youtube_dl/extractor/rai.py')
-rw-r--r--youtube_dl/extractor/rai.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/youtube_dl/extractor/rai.py b/youtube_dl/extractor/rai.py
index 5bf64a56b..625458380 100644
--- a/youtube_dl/extractor/rai.py
+++ b/youtube_dl/extractor/rai.py
@@ -455,3 +455,29 @@ class RaiIE(RaiBaseIE):
info.update(relinker_info)
return info
+
+
+class RaiPlaylistIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?raiplay\.it/programmi/(?P<id>[^/]+)'
+ _TESTS = [{
+ 'url': 'http://www.raiplay.it/programmi/nondirloalmiocapo/',
+ 'info_dict': {
+ 'id': 'nondirloalmiocapo',
+ 'title': 'Non dirlo al mio capo',
+ },
+ 'playlist_mincount': 12,
+ }]
+
+ def _real_extract(self, url):
+ playlist_id = self._match_id(url)
+ webpage = self._download_webpage(url, playlist_id)
+ title = self._html_search_meta('programma', webpage, default=None)
+ video_urls = re.findall(' href="(/raiplay/video.+)"', webpage)
+ video_urls = [urljoin(url, video_url) for video_url in video_urls]
+ entries = [
+ self.url_result(
+ video_url,
+ RaiPlayIE.ie_key())
+ for video_url in video_urls if RaiPlayIE.suitable(video_url)
+ ]
+ return self.playlist_result(entries, playlist_id, title)