1 from .common
import InfoExtractor
14 class GlobalPlayerBaseIE(InfoExtractor
):
15 def _get_page_props(self
, url
, video_id
):
16 webpage
= self
._download
_webpage
(url
, video_id
)
17 return self
._search
_nextjs
_data
(webpage
, video_id
)['props']['pageProps']
19 def _request_ext(self
, url
, video_id
):
20 return urlhandle_detect_ext(self
._request
_webpage
( # Server rejects HEAD requests
21 url
, video_id
, note
='Determining source extension'))
23 def _extract_audio(self
, episode
, series
):
26 **traverse_obj(series
, {
29 'thumbnail': 'imageUrl',
30 'uploader': 'itunesAuthor', # podcasts only
32 **traverse_obj(episode
, {
34 'description': ('description', {clean_html}
),
35 'duration': ('duration', {parse_duration}
),
36 'thumbnail': 'imageUrl',
38 'timestamp': (('pubDate', 'startDate'), {unified_timestamp}
),
44 class GlobalPlayerLiveIE(GlobalPlayerBaseIE
):
45 _VALID_URL
= r
'https?://www\.globalplayer\.com/live/(?P<id>\w+)/\w+'
47 'url': 'https://www.globalplayer.com/live/smoothchill/uk/',
51 'display_id': 'smoothchill-uk',
52 'title': 're:^Smooth Chill.+$',
53 'thumbnail': 'https://herald.musicradio.com/media/f296ade8-50c9-4f60-911f-924e96873620.png',
54 'description': 'Music To Chill To',
55 'live_status': 'is_live',
59 'url': 'https://www.globalplayer.com/live/heart/uk/',
63 'description': 'turn up the feel good!',
64 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png',
65 'live_status': 'is_live',
66 'title': 're:^Heart UK.+$',
67 'display_id': 'heart-uk',
71 'url': 'https://www.globalplayer.com/live/heart/london/',
75 'thumbnail': 'https://herald.musicradio.com/media/49b9e8cb-15bf-4bf2-8c28-a4850cc6b0f3.png',
76 'title': 're:^Heart London.+$',
77 'live_status': 'is_live',
78 'display_id': 'heart-london',
79 'description': 'turn up the feel good!',
83 def _real_extract(self
, url
):
84 video_id
= self
._match
_id
(url
)
85 station
= self
._get
_page
_props
(url
, video_id
)['station']
86 stream_url
= station
['streamUrl']
90 'display_id': join_nonempty('brandSlug', 'slug', from_dict
=station
) or station
.get('legacyStationPrefix'),
92 'ext': self
._request
_ext
(stream_url
, video_id
),
95 **traverse_obj(station
, {
96 'title': (('name', 'brandName'), {str_or_none}
),
97 'description': 'tagline',
98 'thumbnail': 'brandLogo',
103 class GlobalPlayerLivePlaylistIE(GlobalPlayerBaseIE
):
104 _VALID_URL
= r
'https?://www\.globalplayer\.com/playlists/(?P<id>\w+)'
107 'url': 'https://www.globalplayer.com/playlists/8bLk/',
111 'live_status': 'is_live',
112 'description': 'md5:e10f5e10b01a7f2c14ba815509fbb38d',
113 'thumbnail': 'https://images.globalplayer.com/images/551379?width=450&signature=oMLPZIoi5_dBSHnTMREW0Xg76mA=',
114 'title': 're:^Classic FM Hall of Fame.+$'
118 def _real_extract(self
, url
):
119 video_id
= self
._match
_id
(url
)
120 station
= self
._get
_page
_props
(url
, video_id
)['playlistData']
121 stream_url
= station
['streamUrl']
126 'ext': self
._request
_ext
(stream_url
, video_id
),
129 **traverse_obj(station
, {
131 'description': 'description',
132 'thumbnail': 'image',
137 class GlobalPlayerAudioIE(GlobalPlayerBaseIE
):
138 _VALID_URL
= r
'https?://www\.globalplayer\.com/(?:(?P<podcast>podcasts)/|catchup/\w+/\w+/)(?P<id>\w+)/?(?:$|[?#])'
141 'url': 'https://www.globalplayer.com/podcasts/42KuaM/',
142 'playlist_mincount': 5,
145 'title': 'Filthy Ritual',
146 'thumbnail': 'md5:60286e7d12d795bd1bbc9efc6cee643e',
147 'categories': ['Society & Culture', 'True Crime'],
148 'uploader': 'Global',
149 'description': 'md5:da5b918eac9ae319454a10a563afacf9',
153 'url': 'https://www.globalplayer.com/catchup/lbc/uk/46vyD7z/',
154 'playlist_mincount': 3,
157 'description': 'Nick Ferrari At Breakfast is Leading Britain\'s Conversation.',
158 'title': 'Nick Ferrari',
159 'thumbnail': 'md5:4df24d8a226f5b2508efbcc6ae874ebf',
163 def _real_extract(self
, url
):
164 video_id
, podcast
= self
._match
_valid
_url
(url
).group('id', 'podcast')
165 props
= self
._get
_page
_props
(url
, video_id
)
166 series
= props
['podcastInfo'] if podcast
else props
['catchupInfo']
171 'entries': [self
._extract
_audio
(ep
, series
) for ep
in traverse_obj(
172 series
, ('episodes', lambda _
, v
: v
['id'] and v
['streamUrl']))],
173 'categories': traverse_obj(series
, ('categories', ..., 'name')) or None,
174 **traverse_obj(series
, {
175 'description': 'description',
176 'thumbnail': 'imageUrl',
178 'uploader': 'itunesAuthor', # podcasts only
183 class GlobalPlayerAudioEpisodeIE(GlobalPlayerBaseIE
):
184 _VALID_URL
= r
'https?://www\.globalplayer\.com/(?:(?P<podcast>podcasts)|catchup/\w+/\w+)/episodes/(?P<id>\w+)/?(?:$|[?#])'
187 'url': 'https://www.globalplayer.com/podcasts/episodes/7DrfNnE/',
191 'title': 'Filthy Ritual - Trailer',
192 'description': 'md5:1f1562fd0f01b4773b590984f94223e0',
193 'thumbnail': 'md5:60286e7d12d795bd1bbc9efc6cee643e',
195 'timestamp': 1681254900,
196 'series': 'Filthy Ritual',
197 'series_id': '42KuaM',
198 'upload_date': '20230411',
199 'uploader': 'Global',
203 'url': 'https://www.globalplayer.com/catchup/lbc/uk/episodes/2zGq26Vcv1fCWhddC4JAwETXWe/',
205 'id': '2zGq26Vcv1fCWhddC4JAwETXWe',
207 'timestamp': 1682056800,
208 'series': 'Nick Ferrari',
209 'thumbnail': 'md5:4df24d8a226f5b2508efbcc6ae874ebf',
210 'upload_date': '20230421',
211 'series_id': '46vyD7z',
212 'description': 'Nick Ferrari At Breakfast is Leading Britain\'s Conversation.',
213 'title': 'Nick Ferrari',
218 def _real_extract(self
, url
):
219 video_id
, podcast
= self
._match
_valid
_url
(url
).group('id', 'podcast')
220 props
= self
._get
_page
_props
(url
, video_id
)
221 episode
= props
['podcastEpisode'] if podcast
else props
['catchupEpisode']
223 return self
._extract
_audio
(
224 episode
, traverse_obj(episode
, 'podcast', 'show', expected_type
=dict) or {})
227 class GlobalPlayerVideoIE(GlobalPlayerBaseIE
):
228 _VALID_URL
= r
'https?://www\.globalplayer\.com/videos/(?P<id>\w+)'
230 'url': 'https://www.globalplayer.com/videos/2JsSZ7Gm2uP/',
234 'description': 'md5:6a9f063c67c42f218e42eee7d0298bfd',
235 'thumbnail': 'md5:d4498af48e15aae4839ce77b97d39550',
236 'upload_date': '20230420',
237 'title': 'Treble Malakai Bayoh sings a sublime Handel aria at Classic FM Live',
241 def _real_extract(self
, url
):
242 video_id
= self
._match
_id
(url
)
243 meta
= self
._get
_page
_props
(url
, video_id
)['videoData']
247 **traverse_obj(meta
, {
249 'thumbnail': ('image', 'url'),
251 'upload_date': ('publish_date', {unified_strdate}
),
252 'description': 'description',