1 from .common
import InfoExtractor
11 class RinseFMBaseIE(InfoExtractor
):
13 def _parse_entry(entry
):
15 **traverse_obj(entry
, {
17 'title': ('title', {str}
),
18 'url': ('fileUrl', {url_or_none}
),
19 'release_timestamp': ('episodeDate', {parse_iso8601}
),
20 'thumbnail': ('featuredImage', 0, 'filename', {str}
,
21 {lambda x
: x
and f
'https://rinse.imgix.net/media/{x}'}),
22 'webpage_url': ('slug', {str}
,
23 {lambda x
: x
and f
'https://rinse.fm/episodes/{x}'}),
26 'extractor_key': RinseFMIE
.ie_key(),
27 'extractor': RinseFMIE
.IE_NAME
,
31 class RinseFMIE(RinseFMBaseIE
):
32 _VALID_URL
= r
'https?://(?:www\.)?rinse\.fm/episodes/(?P<id>[^/?#]+)'
34 'url': 'https://rinse.fm/episodes/club-glow-15-12-2023-2000/',
35 'md5': '76ee0b719315617df42e15e710f46c7b',
39 'title': 'Club Glow - 15/12/2023 - 20:00',
40 'thumbnail': r
're:^https://.+\.(?:jpg|JPG)$',
41 'release_timestamp': 1702598400,
42 'release_date': '20231215'
46 def _real_extract(self
, url
):
47 display_id
= self
._match
_id
(url
)
48 webpage
= self
._download
_webpage
(url
, display_id
)
49 entry
= self
._search
_nextjs
_data
(webpage
, display_id
)['props']['pageProps']['entry']
51 return self
._parse
_entry
(entry
)
54 class RinseFMArtistPlaylistIE(RinseFMBaseIE
):
55 _VALID_URL
= r
'https?://(?:www\.)?rinse\.fm/shows/(?P<id>[^/?#]+)'
57 'url': 'https://rinse.fm/shows/resources/',
60 'title': '[re]sources',
61 'description': '[re]sources est un label parisien piloté par le DJ et producteur Tommy Kid.'
63 'playlist_mincount': 40
65 'url': 'https://rinse.fm/shows/ivy/',
69 'description': 'A dedicated space for DNB/Turbo House and 4x4.'
71 'playlist_mincount': 7
74 def _entries(self
, data
):
75 for episode
in traverse_obj(data
, (
76 'props', 'pageProps', 'episodes', lambda _
, v
: determine_ext(v
['fileUrl']) in MEDIA_EXTENSIONS
.audio
)
78 yield self
._parse
_entry
(episode
)
80 def _real_extract(self
, url
):
81 playlist_id
= self
._match
_id
(url
)
82 webpage
= self
._download
_webpage
(url
, playlist_id
)
83 title
= self
._og
_search
_title
(webpage
) or self
._html
_search
_meta
('title', webpage
)
84 description
= self
._og
_search
_description
(webpage
) or self
._html
_search
_meta
(
85 'description', webpage
)
86 data
= self
._search
_nextjs
_data
(webpage
, playlist_id
)
88 return self
.playlist_result(
89 self
._entries
(data
), playlist_id
, title
, description
=description
)