1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-25 03:32:05 +00:00

[raiplay:playlist] Add extractor

This commit is contained in:
Timendum 2017-10-23 15:32:45 +02:00 committed by Sergey M․
parent a670b1ba26
commit d21d0ba6c1
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D
2 changed files with 27 additions and 0 deletions

View file

@ -857,6 +857,7 @@ from .rai import (
RaiPlayIE,
RaiPlayLiveIE,
RaiIE,
RaiPlaylistIE,
)
from .rbmaradio import RBMARadioIE
from .rds import RDSIE

View file

@ -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)