diff --git a/youtube_dl/extractor/rai.py b/youtube_dl/extractor/rai.py index 7cf97bb6c..a758d5653 100644 --- a/youtube_dl/extractor/rai.py +++ b/youtube_dl/extractor/rai.py @@ -533,32 +533,35 @@ class RaiPlayRadioBaseIE(InfoExtractor): for attrs in self.parse_list(webpage): title = attrs['data-title'].strip() webpage = urljoin(url, attrs['data-mediapolis']) - audio_url = compat_str(self._request_webpage(webpage, title).geturl()) + audio_url = compat_str(self._request_webpage( + webpage, title).geturl()) yield { 'url': audio_url, 'id': attrs['data-uniquename'].lstrip('ContentItem-'), 'title': title, 'ext': determine_ext(audio_url), 'thumbnail': urljoin(url, attrs['data-image']), - 'language': 'it', - } + 'language': 'it'} def get_playlist(self, *args, **kwargs): return list(self.get_playlist_iter(*args, **kwargs)) class RaiPlayRadioIE(RaiPlayRadioBaseIE): - _VALID_URL = r'%s/audio/.+?-(?P%s)\.html' % (RaiPlayRadioBaseIE._BASE, RaiBaseIE._UUID_RE) + _VALID_URL = r'%s/audio/.+?-(?P%s)\.html' % ( + RaiPlayRadioBaseIE._BASE, RaiBaseIE._UUID_RE) _TEST = { - 'url': 'https://www.raiplayradio.it/audio/2019/07/RADIO3---LEZIONI-DI-MUSICA-36b099ff-4123-4443-9bf9-38e43ef5e025.html', + 'url': 'https://www.raiplayradio.it/audio/2019/07/' + 'RADIO3---LEZIONI-DI-MUSICA-' + '36b099ff-4123-4443-9bf9-38e43ef5e025.html', 'info_dict': { 'id': '36b099ff-4123-4443-9bf9-38e43ef5e025', 'ext': 'mp3', - 'title': 'Dal "Chiaro di luna" al "Clair de lune", prima parte con Giovanni Bietti', - 'thumbnail': 'https://www.raiplayradio.it/cropgd/400x400/dl/img/2019/07/08/1562590329054_luna.jpg', - 'language': 'it', - } - } + 'title': 'Dal "Chiaro di luna" al "Clair de lune", ' + 'prima parte con Giovanni Bietti', + 'thumbnail': 'https://www.raiplayradio.it/cropgd/400x400/dl/' + 'img/2019/07/08/1562590329054_luna.jpg', + 'language': 'it'}} def _real_extract(self, url): list_url = url.replace('.html', '-list.html') @@ -568,25 +571,30 @@ class RaiPlayRadioIE(RaiPlayRadioBaseIE): class RaiPlayRadioPlaylistIE(RaiPlayRadioBaseIE): - _VALID_URL = r'%s/playlist/.+?-(?P%s)\.html' % (RaiPlayRadioBaseIE._BASE, RaiBaseIE._UUID_RE) + _VALID_URL = r'%s/playlist/.+?-(?P%s)\.html' % ( + RaiPlayRadioBaseIE._BASE, RaiBaseIE._UUID_RE) _TEST = { - 'url': 'https://www.raiplayradio.it/playlist/2017/12/Alice-nel-paese-delle-meraviglie-72371d3c-d998-49f3-8860-d168cfdf4966.html', + 'url': 'https://www.raiplayradio.it/playlist/2017/12/' + 'Alice-nel-paese-delle-meraviglie-' + '72371d3c-d998-49f3-8860-d168cfdf4966.html', 'info_dict': { 'id': '72371d3c-d998-49f3-8860-d168cfdf4966', 'title': "Alice nel paese delle meraviglie", - 'description': "di Lewis Carrol letto da Aldo Busi", - }, - 'playlist_count': 11, - } + 'description': "di Lewis Carrol letto da Aldo Busi"}, + 'playlist_count': 11} def _real_extract(self, url): playlist_id = self._match_id(url) playlist_webpage = self._download_webpage(url, playlist_id) - playlist_title = unescapeHTML(self._html_search_regex(r'data-playlist-title="(.+?)"', playlist_webpage, 'title')) - playlist_creator = self._html_search_meta('nomeProgramma', playlist_webpage) - playlist_description = get_element_by_class('textDescriptionProgramma', playlist_webpage) + playlist_title = unescapeHTML(self._html_search_regex( + r'data-playlist-title="(.+?)"', playlist_webpage, 'title')) + playlist_creator = self._html_search_meta( + 'nomeProgramma', playlist_webpage) + playlist_description = get_element_by_class( + 'textDescriptionProgramma', playlist_webpage) - player_href = self._html_search_regex(r'data-player-href="(.+?)"', playlist_webpage, 'href') + player_href = self._html_search_regex( + r'data-player-href="(.+?)"', playlist_webpage, 'href') list_url = urljoin(url, player_href) entries = self.get_playlist(list_url) @@ -595,7 +603,7 @@ class RaiPlayRadioPlaylistIE(RaiPlayRadioBaseIE): 'track': entry['title'], 'track_number': index, 'album': playlist_title, - 'artist': playlist_creator, - }) + 'artist': playlist_creator}) - return self.playlist_result(entries, playlist_id, playlist_title, playlist_description) + return self.playlist_result( + entries, playlist_id, playlist_title, playlist_description)