|
|
|
@ -3,12 +3,14 @@ from ..utils import (
|
|
|
|
MEDIA_EXTENSIONS,
|
|
|
|
MEDIA_EXTENSIONS,
|
|
|
|
determine_ext,
|
|
|
|
determine_ext,
|
|
|
|
parse_iso8601,
|
|
|
|
parse_iso8601,
|
|
|
|
traverse_obj,
|
|
|
|
|
|
|
|
url_or_none,
|
|
|
|
url_or_none,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
from ..utils.traversal import traverse_obj
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RinseFMBaseIE(InfoExtractor):
|
|
|
|
class RinseFMBaseIE(InfoExtractor):
|
|
|
|
|
|
|
|
_API_BASE = 'https://rinse.fm/api/query/v1'
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def _parse_entry(entry):
|
|
|
|
def _parse_entry(entry):
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
@ -45,8 +47,10 @@ class RinseFMIE(RinseFMBaseIE):
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
display_id = self._match_id(url)
|
|
|
|
display_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, display_id)
|
|
|
|
|
|
|
|
entry = self._search_nextjs_data(webpage, display_id)['props']['pageProps']['entry']
|
|
|
|
entry = self._download_json(
|
|
|
|
|
|
|
|
f'{self._API_BASE}/episodes/{display_id}', display_id,
|
|
|
|
|
|
|
|
note='Downloading episode data from API')['entry']
|
|
|
|
|
|
|
|
|
|
|
|
return self._parse_entry(entry)
|
|
|
|
return self._parse_entry(entry)
|
|
|
|
|
|
|
|
|
|
|
|
@ -58,32 +62,35 @@ class RinseFMArtistPlaylistIE(RinseFMBaseIE):
|
|
|
|
'info_dict': {
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'resources',
|
|
|
|
'id': 'resources',
|
|
|
|
'title': '[re]sources',
|
|
|
|
'title': '[re]sources',
|
|
|
|
'description': '[re]sources est un label parisien piloté par le DJ et producteur Tommy Kid.',
|
|
|
|
'description': 'md5:fd6a7254e8273510e6d49fbf50edf392',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'playlist_mincount': 40,
|
|
|
|
'playlist_mincount': 40,
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
'url': 'https://rinse.fm/shows/ivy/',
|
|
|
|
'url': 'https://www.rinse.fm/shows/esk',
|
|
|
|
'info_dict': {
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'ivy',
|
|
|
|
'id': 'esk',
|
|
|
|
'title': '[IVY]',
|
|
|
|
'title': 'Esk',
|
|
|
|
'description': 'A dedicated space for DNB/Turbo House and 4x4.',
|
|
|
|
'description': 'md5:5893d7c1d411ae8dea7fba12f109aa98',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'playlist_mincount': 7,
|
|
|
|
'playlist_mincount': 139,
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _entries(self, data):
|
|
|
|
def _entries(self, data):
|
|
|
|
for episode in traverse_obj(data, (
|
|
|
|
for episode in traverse_obj(data, (
|
|
|
|
'props', 'pageProps', 'episodes', lambda _, v: determine_ext(v['fileUrl']) in MEDIA_EXTENSIONS.audio),
|
|
|
|
'episodes', lambda _, v: determine_ext(v['fileUrl']) in MEDIA_EXTENSIONS.audio),
|
|
|
|
):
|
|
|
|
):
|
|
|
|
yield self._parse_entry(episode)
|
|
|
|
yield self._parse_entry(episode)
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
playlist_id = self._match_id(url)
|
|
|
|
playlist_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, playlist_id)
|
|
|
|
|
|
|
|
title = self._og_search_title(webpage) or self._html_search_meta('title', webpage)
|
|
|
|
api_data = self._download_json(
|
|
|
|
description = self._og_search_description(webpage) or self._html_search_meta(
|
|
|
|
f'{self._API_BASE}/shows/{playlist_id}', playlist_id,
|
|
|
|
'description', webpage)
|
|
|
|
note='Downloading show data from API')
|
|
|
|
data = self._search_nextjs_data(webpage, playlist_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return self.playlist_result(
|
|
|
|
return self.playlist_result(
|
|
|
|
self._entries(data), playlist_id, title, description=description)
|
|
|
|
self._entries(api_data), playlist_id,
|
|
|
|
|
|
|
|
**traverse_obj(api_data, ('entry', {
|
|
|
|
|
|
|
|
'title': ('title', {str}),
|
|
|
|
|
|
|
|
'description': ('description', {str}),
|
|
|
|
|
|
|
|
})))
|
|
|
|
|