Compare commits

..

3 Commits

Author SHA1 Message Date
SirElderling
8eb987d9ca [RinseFM] - Apply bashonly suggestions - missing webpage_url 2024-01-13 18:34:11 +00:00
SirElderling
172369e9f5 [RinseFM] - Apply bashonly suggestions 2024-01-13 18:28:29 +00:00
SirElderling
70ff5d5aa3 [RinseFM] - Adjustments to _parse_entry 2024-01-13 16:33:57 +00:00

View File

@ -1,5 +1,11 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import format_field, parse_iso8601, traverse_obj from ..utils import (
MEDIA_EXTENSIONS,
determine_ext,
parse_iso8601,
traverse_obj,
url_or_none,
)
class RinseFMBaseIE(InfoExtractor): class RinseFMBaseIE(InfoExtractor):
@ -7,14 +13,18 @@ class RinseFMBaseIE(InfoExtractor):
def _parse_entry(entry): def _parse_entry(entry):
return { return {
**traverse_obj(entry, { **traverse_obj(entry, {
'id': ('id'), 'id': ('id', {str}),
'title': ('title'), 'title': ('title', {str}),
'url': ('fileUrl'), 'url': ('fileUrl', {url_or_none}),
'vcode': 'none',
'release_timestamp': ('episodeDate', {parse_iso8601}), 'release_timestamp': ('episodeDate', {parse_iso8601}),
'thumbnail': ('featuredImage', 0, 'filename', {str},
{lambda x: x and f'https://rinse.imgix.net/media/{x}'}),
'webpage_url': ('slug', {str},
{lambda x: x and f'https://rinse.fm/episodes/{x}'}),
}), }),
'thumbnail': format_field( 'vcodec': 'none',
entry, [('featuredImage', 0, 'filename')], 'https://rinse.imgix.net/media/%s', default=None), 'extractor_key': RinseFMIE.ie_key(),
'extractor': RinseFMIE.IE_NAME,
} }
@ -74,7 +84,8 @@ class RinseFMArtistPlaylistIE(RinseFMBaseIE):
episodes = traverse_obj( episodes = traverse_obj(
self._search_nextjs_data(webpage, playlist_id), self._search_nextjs_data(webpage, playlist_id),
('props', 'pageProps', 'episodes', lambda _, v: v['fileUrl'].endswith('mp3'))) ('props', 'pageProps', 'episodes',
lambda _, v: determine_ext(v['fileUrl']) in MEDIA_EXTENSIONS.audio))
return self.playlist_result( return self.playlist_result(
self._entries(episodes), playlist_id, title, description=description) self._entries(episodes), playlist_id, title, description=description)