4 from .common
import InfoExtractor
17 class NDRBaseIE(InfoExtractor
):
18 def _real_extract(self
, url
):
19 mobj
= self
._match
_valid
_url
(url
)
20 display_id
= next(group
for group
in mobj
.groups() if group
)
21 webpage
= self
._download
_webpage
(url
, display_id
)
22 return self
._extract
_embed
(webpage
, display_id
, url
)
25 class NDRIE(NDRBaseIE
):
27 IE_DESC
= 'NDR.de - Norddeutscher Rundfunk'
28 _VALID_URL
= r
'https?://(?:\w+\.)*ndr\.de/(?:[^/]+/)*(?P<id>[^/?#]+),[\da-z]+\.html'
30 # httpVideo, same content id
31 'url': 'http://www.ndr.de/fernsehen/Party-Poette-und-Parade,hafengeburtstag988.html',
32 'md5': '6515bc255dc5c5f8c85bbc38e035a659',
34 'id': 'hafengeburtstag988',
35 'display_id': 'Party-Poette-und-Parade',
37 'title': 'Party, Pötte und Parade',
38 'description': 'md5:ad14f9d2f91d3040b6930c697e5f6b4c',
40 'timestamp': 1431255671,
41 'upload_date': '20150510',
45 'skip_download': True,
47 'expected_warnings': ['Unable to download f4m manifest'],
49 # httpVideo, different content id
50 'url': 'http://www.ndr.de/sport/fussball/40-Osnabrueck-spielt-sich-in-einen-Rausch,osna270.html',
51 'md5': '1043ff203eab307f0c51702ec49e9a71',
54 'display_id': '40-Osnabrueck-spielt-sich-in-einen-Rausch',
56 'title': 'Osnabrück - Wehen Wiesbaden: Die Highlights',
57 'description': 'md5:32e9b800b3d2d4008103752682d5dc01',
59 'timestamp': 1442059200,
60 'upload_date': '20150912',
64 'skip_download': True,
66 'skip': 'No longer available',
68 # httpAudio, same content id
69 'url': 'http://www.ndr.de/info/La-Valette-entgeht-der-Hinrichtung,audio51535.html',
70 'md5': 'bb3cd38e24fbcc866d13b50ca59307b8',
73 'display_id': 'La-Valette-entgeht-der-Hinrichtung',
75 'title': 'La Valette entgeht der Hinrichtung',
76 'description': 'md5:22f9541913a40fe50091d5cdd7c9f536',
77 'uploader': 'ndrinfo',
78 'timestamp': 1631711863,
79 'upload_date': '20210915',
83 'skip_download': True,
87 'url': 'https://www.ndr.de/fernsehen/sendungen/extra_3/extra-3-Satiremagazin-mit-Christian-Ehring,sendung1091858.html',
90 'display_id': 'extra-3-Satiremagazin-mit-Christian-Ehring',
92 'title': 'Extra 3 vom 11.11.2020 mit Christian Ehring',
93 'description': 'md5:700f6de264010585012a72f97b0ac0c9',
95 'upload_date': '20201207',
96 'timestamp': 1614349457,
101 'url': r
're:^https://www\.ndr\.de.+',
106 'skip_download': True,
108 'expected_warnings': ['Unable to download f4m manifest'],
110 'url': 'https://www.ndr.de/Fettes-Brot-Ferris-MC-und-Thees-Uhlmann-live-on-stage,festivalsommer116.html',
111 'only_matching': True,
114 def _extract_embed(self
, webpage
, display_id
, url
):
116 self
._html
_search
_meta
(
117 'embedURL', webpage
, 'embed URL',
119 or self
._search
_regex
(
120 r
'\bembedUrl["\']\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
121 'embed URL', group='url', default=None)
122 or self._search_regex(
123 r'\bvar\s*sophoraID\s*=\s*(["\'])(?P
<url
>(?
:(?
!\
1).)+)\
1', webpage,
124 'embed URL
', group='url
', default=''))
125 # some more work needed if we only found sophoraID
126 if re.match(r'^
[a
-z
]+\d
+$
', embed_url):
127 # get the initial part of the url path,. eg /panorama/archiv/2022/
128 parsed_url = urllib.parse.urlparse(url)
129 path = self._search_regex(rf'(.+/){display_id}
', parsed_url.path or '', 'embed URL
', default='')
130 # find tell-tale image with the actual ID
131 ndr_id = self._search_regex(rf'{path}
([a
-z
]+\d
+)(?
!\
.)\b', webpage, 'embed URL
', default=None)
132 # or try to use special knowledge!
133 NDR_INFO_URL_TPL = 'https
://www
.ndr
.de
/info
/%s-player
.html
'
134 embed_url = f'ndr
:{ndr_id}
' if ndr_id else NDR_INFO_URL_TPL % (embed_url, )
136 raise ExtractorError('Unable to extract embedUrl
')
138 description = self._search_regex(
139 r'<p
[^
>]+itemprop
="description">([^
<]+)</p
>',
140 webpage, 'description
', default=None) or self._og_search_description(webpage)
141 timestamp = parse_iso8601(
143 (r'<span
[^
>]+itemprop
="(?:datePublished|uploadDate)"[^
>]+content
="(?P<cont>[^"]+)"',
144 r'\bvar\s*pdt\s*=\s*(?P<q>["\'])(?P
<cont
>(?
:(?
!(?P
=q
)).)+)(?P
=q
)'),
145 webpage, 'upload date
', group='cont
', default=None))
146 info = self._search_json_ld(webpage, display_id, default={})
148 '_type
': 'url_transparent
',
150 'display_id
': display_id,
151 'description
': description,
152 'timestamp
': timestamp,
156 class NJoyIE(NDRBaseIE):
159 _VALID_URL = r'https?
://(?
:www\
.)?n
-joy\
.de
/(?
:[^
/]+/)*(?
:(?P
<display_id
>[^
/?
#]+),)?(?P<id>[\da-z]+)\.html'
161 # httpVideo, same content id
162 'url': 'http://www.n-joy.de/entertainment/comedy/comedy_contest/Benaissa-beim-NDR-Comedy-Contest,comedycontest2480.html',
163 'md5': 'cb63be60cd6f9dd75218803146d8dc67',
165 'id': 'comedycontest2480',
166 'display_id': 'Benaissa-beim-NDR-Comedy-Contest',
168 'title': 'Benaissa beim NDR Comedy Contest',
169 'description': 'md5:f057a6c4e1c728b10d33b5ffd36ddc39',
171 'upload_date': '20141129',
175 'skip_download': True,
177 'skip': 'No longer available',
179 # httpVideo, different content id
180 'url': 'http://www.n-joy.de/musik/Das-frueheste-DJ-Set-des-Nordens-live-mit-Felix-Jaehn-,felixjaehn168.html',
181 'md5': '417660fffa90e6df2fda19f1b40a64d8',
183 'id': 'livestream283',
184 'display_id': 'Das-frueheste-DJ-Set-des-Nordens-live-mit-Felix-Jaehn-',
186 'title': 'Das frueheste DJ Set des Nordens live mit Felix Jaehn',
187 'description': 'md5:681698f527b8601e511e7b79edde7d2c',
189 'upload_date': '20210830',
192 'skip_download': True,
195 'url': 'http://www.n-joy.de/radio/webradio/morningshow209.html',
196 'only_matching': True,
199 def _extract_embed(self
, webpage
, display_id
, url
=None):
200 # find tell-tale URL with the actual ID, or ...
201 video_id
= self
._search
_regex
(
202 (r
'''\bsrc\s*=\s*["']?(?:/\w+)+/([a-z]+\d+)(?!\.)\b''',
203 r
'<iframe[^>]+id="pp_([\da-z]+)"'),
204 webpage
, 'NDR id', default
=None)
207 self
._html
_search
_meta
('description', webpage
)
208 or self
._search
_regex
(
209 r
'<div[^>]+class="subline"[^>]*>[^<]+</div>\s*<p>([^<]+)</p>',
210 webpage
, 'description', fatal
=False))
212 '_type': 'url_transparent',
213 'ie_key': 'NDREmbedBase',
214 'url': f
'ndr:{video_id}',
215 'display_id': display_id
,
216 'description': description
,
217 'title': display_id
.replace('-', ' ').strip(),
221 class NDREmbedBaseIE(InfoExtractor
): # XXX: Conventionally, Concrete class names do not end in BaseIE
222 IE_NAME
= 'ndr:embed:base'
223 _VALID_URL
= r
'(?:ndr:(?P<id_s>[\da-z]+)|https?://www\.ndr\.de/(?P<id>[\da-z]+)-ppjson\.json)'
225 'url': 'ndr:soundcheck3366',
226 'only_matching': True,
228 'url': 'http://www.ndr.de/soundcheck3366-ppjson.json',
229 'only_matching': True,
232 def _real_extract(self
, url
):
233 mobj
= self
._match
_valid
_url
(url
)
234 video_id
= mobj
.group('id') or mobj
.group('id_s')
236 ppjson
= self
._download
_json
(
237 f
'http://www.ndr.de/{video_id}-ppjson.json', video_id
)
239 playlist
= ppjson
['playlist']
242 quality_key
= qualities(('xs', 's', 'm', 'l', 'xl'))
244 for format_id
, f
in playlist
.items():
248 ext
= determine_ext(src
, None)
250 formats
.extend(self
._extract
_f
4m
_formats
(
251 src
+ '?hdcore=3.7.0&plugin=aasp-3.7.0.39.44', video_id
,
252 f4m_id
='hds', fatal
=False))
254 formats
.extend(self
._extract
_m
3u8_formats
(
255 src
, video_id
, 'mp4', m3u8_id
='hls',
256 entry_protocol
='m3u8_native', fatal
=False))
258 quality
= f
.get('quality')
261 'format_id': quality
or format_id
,
262 'quality': quality_key(quality
),
264 type_
= f
.get('type')
265 if type_
and type_
.split('/')[0] == 'audio':
266 ff
['vcodec'] = 'none'
267 ff
['ext'] = ext
or 'mp3'
270 config
= playlist
['config']
272 live
= playlist
.get('config', {}).get('streamType') in ['httpVideoLive', 'httpAudioLive']
273 title
= config
['title']
274 uploader
= ppjson
.get('config', {}).get('branding')
275 upload_date
= ppjson
.get('config', {}).get('publicationDate')
276 duration
= int_or_none(config
.get('duration'))
279 poster
= try_get(config
, lambda x
: x
['poster'], dict) or {}
280 for thumbnail_id
, thumbnail
in poster
.items():
281 thumbnail_url
= urljoin(url
, thumbnail
.get('src'))
282 if not thumbnail_url
:
285 'id': thumbnail
.get('quality') or thumbnail_id
,
286 'url': thumbnail_url
,
287 'preference': quality_key(thumbnail
.get('quality')),
291 tracks
= config
.get('tracks')
292 if tracks
and isinstance(tracks
, list):
294 if not isinstance(track
, dict):
296 track_url
= urljoin(url
, track
.get('src'))
299 subtitles
.setdefault(track
.get('srclang') or 'de', []).append({
308 'uploader': uploader
if uploader
!= '-' else None,
309 'upload_date': upload_date
[0:8] if upload_date
else None,
310 'duration': duration
,
311 'thumbnails': thumbnails
,
313 'subtitles': subtitles
,
317 class NDREmbedIE(NDREmbedBaseIE
): # XXX: Do not subclass from concrete IE
318 IE_NAME
= 'ndr:embed'
319 _VALID_URL
= r
'https?://(?:\w+\.)*ndr\.de/(?:[^/]+/)*(?P<id>[\da-z]+)-(?:(?:ard)?player|externalPlayer)\.html'
321 'url': 'http://www.ndr.de/fernsehen/sendungen/ndr_aktuell/ndraktuell28488-player.html',
322 'md5': '8b9306142fe65bbdefb5ce24edb6b0a9',
324 'id': 'ndraktuell28488',
326 'title': 'Norddeutschland begrüßt Flüchtlinge',
329 'upload_date': '20150907',
332 'skip': 'No longer available',
334 'url': 'http://www.ndr.de/ndr2/events/soundcheck/soundcheck3366-player.html',
335 'md5': '002085c44bae38802d94ae5802a36e78',
337 'id': 'soundcheck3366',
339 'title': 'Ella Henderson braucht Vergleiche nicht zu scheuen',
342 'upload_date': '20150912',
346 'skip_download': True,
348 'skip': 'No longer available',
350 'url': 'http://www.ndr.de/info/audio51535-player.html',
351 'md5': 'bb3cd38e24fbcc866d13b50ca59307b8',
355 'title': 'La Valette entgeht der Hinrichtung',
357 'uploader': 'ndrinfo',
358 'upload_date': '20210915',
362 'skip_download': True,
365 'url': 'http://www.ndr.de/fernsehen/sendungen/visite/visite11010-externalPlayer.html',
366 'md5': 'ae57f80511c1e1f2fd0d0d3d31aeae7c',
370 'title': 'Visite - die ganze Sendung',
373 'upload_date': '20150902',
377 'skip_download': True,
379 'skip': 'No longer available',
382 'url': 'http://www.ndr.de/fernsehen/livestream/livestream217-externalPlayer.html',
384 'id': 'livestream217',
386 'title': r
're:^NDR Fernsehen Niedersachsen \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
388 'upload_date': '20210409',
392 'skip_download': True,
395 'url': 'http://www.ndr.de/ndrkultur/audio255020-player.html',
396 'only_matching': True,
398 'url': 'http://www.ndr.de/fernsehen/sendungen/nordtour/nordtour7124-player.html',
399 'only_matching': True,
401 'url': 'http://www.ndr.de/kultur/film/videos/videoimport10424-player.html',
402 'only_matching': True,
404 'url': 'http://www.ndr.de/fernsehen/sendungen/hamburg_journal/hamj43006-player.html',
405 'only_matching': True,
407 'url': 'http://www.ndr.de/fernsehen/sendungen/weltbilder/weltbilder4518-player.html',
408 'only_matching': True,
410 'url': 'http://www.ndr.de/fernsehen/doku952-player.html',
411 'only_matching': True,
415 class NJoyEmbedIE(NDREmbedBaseIE
): # XXX: Do not subclass from concrete IE
416 IE_NAME
= 'njoy:embed'
417 _VALID_URL
= r
'https?://(?:www\.)?n-joy\.de/(?:[^/]+/)*(?P<id>[\da-z]+)-(?:player|externalPlayer)_[^/]+\.html'
420 'url': 'http://www.n-joy.de/events/reeperbahnfestival/doku948-player_image-bc168e87-5263-4d6d-bd27-bb643005a6de_theme-n-joy.html',
421 'md5': '8483cbfe2320bd4d28a349d62d88bd74',
425 'title': 'Zehn Jahre Reeperbahn Festival - die Doku',
427 'upload_date': '20200826',
430 'expected_warnings': ['Unable to download f4m manifest'],
433 'url': 'http://www.n-joy.de/news_wissen/stefanrichter100-player_image-d5e938b1-f21a-4b9a-86b8-aaba8bca3a13_theme-n-joy.html',
434 'md5': 'd989f80f28ac954430f7b8a48197188a',
436 'id': 'stefanrichter100',
438 'title': 'Interview mit einem Augenzeugen',
441 'upload_date': '20150909',
445 'skip_download': True,
447 'skip': 'No longer available',
449 # httpAudioLive, no explicit ext
450 'url': 'http://www.n-joy.de/news_wissen/webradioweltweit100-player_image-3fec0484-2244-4565-8fb8-ed25fd28b173_theme-n-joy.html',
452 'id': 'webradioweltweit100',
454 'title': r
're:^N-JOY Weltweit \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
457 'upload_date': '20210830',
460 'skip_download': True,
463 'url': 'http://www.n-joy.de/musik/dockville882-player_image-3905259e-0803-4764-ac72-8b7de077d80a_theme-n-joy.html',
464 'only_matching': True,
466 'url': 'http://www.n-joy.de/radio/sendungen/morningshow/urlaubsfotos190-player_image-066a5df1-5c95-49ec-a323-941d848718db_theme-n-joy.html',
467 'only_matching': True,
469 'url': 'http://www.n-joy.de/entertainment/comedy/krudetv290-player_image-ab261bfe-51bf-4bf3-87ba-c5122ee35b3d_theme-n-joy.html',
470 'only_matching': True,