]>
jfr.im git - yt-dlp.git/blob - youtube_dlc/extractor/ndr.py
f3897c71bfd300aa8abd219ad45cf32b92d95781
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
18 class NDRBaseIE(InfoExtractor
):
19 def _real_extract(self
, url
):
20 mobj
= re
.match(self
._VALID
_URL
, url
)
21 display_id
= next(group
for group
in mobj
.groups() if group
)
23 webpage
= self
._download
_webpage
(url
, display_id
)
24 return self
._extract
_embed
(webpage
, display_id
, id)
27 class NDRIE(NDRBaseIE
):
29 IE_DESC
= 'NDR.de - Norddeutscher Rundfunk'
30 _VALID_URL
= r
'https?://(?:www\.)?(?:daserste\.)?ndr\.de/(?:[^/]+/)*(?P<display_id>[^/?#]+),(?P<id>[\da-z]+)\.html'
32 # httpVideo, same content id
33 'url': 'http://www.ndr.de/fernsehen/Party-Poette-und-Parade,hafengeburtstag988.html',
34 'md5': '6515bc255dc5c5f8c85bbc38e035a659',
36 'id': 'hafengeburtstag988',
37 'display_id': 'Party-Poette-und-Parade',
39 'title': 'Party, Pötte und Parade',
40 'description': 'md5:ad14f9d2f91d3040b6930c697e5f6b4c',
42 'timestamp': 1431108900,
43 'upload_date': '20150510',
47 'skip_download': True,
50 # httpVideo, different content id
51 'url': 'http://www.ndr.de/sport/fussball/40-Osnabrueck-spielt-sich-in-einen-Rausch,osna270.html',
52 'md5': '1043ff203eab307f0c51702ec49e9a71',
55 'display_id': '40-Osnabrueck-spielt-sich-in-einen-Rausch',
57 'title': 'Osnabrück - Wehen Wiesbaden: Die Highlights',
58 'description': 'md5:32e9b800b3d2d4008103752682d5dc01',
60 'timestamp': 1442059200,
61 'upload_date': '20150912',
65 'skip_download': True,
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': 1290626100,
79 'upload_date': '20140729',
83 'skip_download': True,
86 'url': 'https://www.ndr.de/Fettes-Brot-Ferris-MC-und-Thees-Uhlmann-live-on-stage,festivalsommer116.html',
87 'only_matching': True,
90 def _extract_embed(self
, webpage
, display_id
, id):
91 embed_url
= self
._html
_search
_meta
(
92 'embedURL', webpage
, 'embed URL',
93 default
=None) or self
._search
_regex
(
94 r
'\bembedUrl["\']\s
*:\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
95 'embed URL', fatal=False, group='url')
97 return self.url_result('ndr:%s' % id, ie=NDREmbedBaseIE.ie_key())
98 description = self._search_regex(
99 r'<p[^>]+itemprop="description
">([^<]+)</p>',
100 webpage, 'description', default=None) or self._og_search_description(webpage)
101 timestamp = parse_iso8601(
103 r'<span[^>]+itemprop="(?
:datePublished|uploadDate
)"[^>]+content="([^
"]+)"',
104 webpage, 'upload date
', default=None))
105 info = self._search_json_ld(webpage, display_id, default={})
107 '_type
': 'url_transparent
',
109 'display_id
': display_id,
110 'description
': description,
111 'timestamp
': timestamp,
115 class NJoyIE(NDRBaseIE):
118 _VALID_URL = r'https?
://(?
:www\
.)?n
-joy\
.de
/(?
:[^
/]+/)*(?
:(?P
<display_id
>[^
/?
#]+),)?(?P<id>[\da-z]+)\.html'
120 # httpVideo, same content id
121 'url': 'http://www.n-joy.de/entertainment/comedy/comedy_contest/Benaissa-beim-NDR-Comedy-Contest,comedycontest2480.html',
122 'md5': 'cb63be60cd6f9dd75218803146d8dc67',
124 'id': 'comedycontest2480',
125 'display_id': 'Benaissa-beim-NDR-Comedy-Contest',
127 'title': 'Benaissa beim NDR Comedy Contest',
128 'description': 'md5:f057a6c4e1c728b10d33b5ffd36ddc39',
130 'upload_date': '20141129',
134 'skip_download': True,
137 # httpVideo, different content id
138 'url': 'http://www.n-joy.de/musik/Das-frueheste-DJ-Set-des-Nordens-live-mit-Felix-Jaehn-,felixjaehn168.html',
139 'md5': '417660fffa90e6df2fda19f1b40a64d8',
141 'id': 'dockville882',
142 'display_id': 'Das-frueheste-DJ-Set-des-Nordens-live-mit-Felix-Jaehn-',
144 'title': '"Ich hab noch nie" mit Felix Jaehn',
145 'description': 'md5:85dd312d53be1b99e1f998a16452a2f3',
147 'upload_date': '20150822',
151 'skip_download': True,
154 'url': 'http://www.n-joy.de/radio/webradio/morningshow209.html',
155 'only_matching': True,
158 def _extract_embed(self
, webpage
, display_id
, id):
159 video_id
= self
._search
_regex
(
160 r
'<iframe[^>]+id="pp_([\da-z]+)"', webpage
, 'embed id')
161 description
= self
._search
_regex
(
162 r
'<div[^>]+class="subline"[^>]*>[^<]+</div>\s*<p>([^<]+)</p>',
163 webpage
, 'description', fatal
=False)
165 '_type': 'url_transparent',
166 'ie_key': 'NDREmbedBase',
167 'url': 'ndr:%s' % video_id
,
168 'display_id': display_id
,
169 'description': description
,
173 class NDREmbedBaseIE(InfoExtractor
):
174 IE_NAME
= 'ndr:embed:base'
175 _VALID_URL
= r
'(?:ndr:(?P<id_s>[\da-z]+)|https?://www\.ndr\.de/(?P<id>[\da-z]+)-ppjson\.json)'
177 'url': 'ndr:soundcheck3366',
178 'only_matching': True,
180 'url': 'http://www.ndr.de/soundcheck3366-ppjson.json',
181 'only_matching': True,
184 def _real_extract(self
, url
):
185 mobj
= re
.match(self
._VALID
_URL
, url
)
186 video_id
= mobj
.group('id') or mobj
.group('id_s')
188 ppjson
= self
._download
_json
(
189 'http://www.ndr.de/%s-ppjson.json' % video_id
, video_id
)
191 playlist
= ppjson
['playlist']
194 quality_key
= qualities(('xs', 's', 'm', 'l', 'xl'))
196 for format_id
, f
in playlist
.items():
200 ext
= determine_ext(src
, None)
202 formats
.extend(self
._extract
_f
4m
_formats
(
203 src
+ '?hdcore=3.7.0&plugin=aasp-3.7.0.39.44', video_id
,
204 f4m_id
='hds', fatal
=False))
206 formats
.extend(self
._extract
_m
3u8_formats
(
207 src
, video_id
, 'mp4', m3u8_id
='hls',
208 entry_protocol
='m3u8_native', fatal
=False))
210 quality
= f
.get('quality')
213 'format_id': quality
or format_id
,
214 'quality': quality_key(quality
),
216 type_
= f
.get('type')
217 if type_
and type_
.split('/')[0] == 'audio':
218 ff
['vcodec'] = 'none'
219 ff
['ext'] = ext
or 'mp3'
221 self
._sort
_formats
(formats
)
223 config
= playlist
['config']
225 live
= playlist
.get('config', {}).get('streamType') in ['httpVideoLive', 'httpAudioLive']
226 title
= config
['title']
228 title
= self
._live
_title
(title
)
229 uploader
= ppjson
.get('config', {}).get('branding')
230 upload_date
= ppjson
.get('config', {}).get('publicationDate')
231 duration
= int_or_none(config
.get('duration'))
234 poster
= try_get(config
, lambda x
: x
['poster'], dict) or {}
235 for thumbnail_id
, thumbnail
in poster
.items():
236 thumbnail_url
= urljoin(url
, thumbnail
.get('src'))
237 if not thumbnail_url
:
240 'id': thumbnail
.get('quality') or thumbnail_id
,
241 'url': thumbnail_url
,
242 'preference': quality_key(thumbnail
.get('quality')),
249 'uploader': uploader
if uploader
!= '-' else None,
250 'upload_date': upload_date
[0:8] if upload_date
else None,
251 'duration': duration
,
252 'thumbnails': thumbnails
,
257 class NDREmbedIE(NDREmbedBaseIE
):
258 IE_NAME
= 'ndr:embed'
259 _VALID_URL
= r
'https?://(?:www\.)?(?:daserste\.)?ndr\.de/(?:[^/]+/)*(?P<id>[\da-z]+)-(?:player|externalPlayer)\.html'
261 'url': 'http://www.ndr.de/fernsehen/sendungen/ndr_aktuell/ndraktuell28488-player.html',
262 'md5': '8b9306142fe65bbdefb5ce24edb6b0a9',
264 'id': 'ndraktuell28488',
266 'title': 'Norddeutschland begrüßt Flüchtlinge',
269 'upload_date': '20150907',
273 'url': 'http://www.ndr.de/ndr2/events/soundcheck/soundcheck3366-player.html',
274 'md5': '002085c44bae38802d94ae5802a36e78',
276 'id': 'soundcheck3366',
278 'title': 'Ella Henderson braucht Vergleiche nicht zu scheuen',
281 'upload_date': '20150912',
285 'skip_download': True,
288 'url': 'http://www.ndr.de/info/audio51535-player.html',
289 'md5': 'bb3cd38e24fbcc866d13b50ca59307b8',
293 'title': 'La Valette entgeht der Hinrichtung',
295 'uploader': 'ndrinfo',
296 'upload_date': '20140729',
300 'skip_download': True,
303 'url': 'http://www.ndr.de/fernsehen/sendungen/visite/visite11010-externalPlayer.html',
304 'md5': 'ae57f80511c1e1f2fd0d0d3d31aeae7c',
308 'title': 'Visite - die ganze Sendung',
311 'upload_date': '20150902',
315 'skip_download': True,
319 'url': 'http://www.ndr.de/fernsehen/livestream/livestream217-externalPlayer.html',
321 'id': 'livestream217',
323 'title': r
're:^NDR Fernsehen Niedersachsen \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
325 'upload_date': '20150910',
328 'skip_download': True,
331 'url': 'http://www.ndr.de/ndrkultur/audio255020-player.html',
332 'only_matching': True,
334 'url': 'http://www.ndr.de/fernsehen/sendungen/nordtour/nordtour7124-player.html',
335 'only_matching': True,
337 'url': 'http://www.ndr.de/kultur/film/videos/videoimport10424-player.html',
338 'only_matching': True,
340 'url': 'http://www.ndr.de/fernsehen/sendungen/hamburg_journal/hamj43006-player.html',
341 'only_matching': True,
343 'url': 'http://www.ndr.de/fernsehen/sendungen/weltbilder/weltbilder4518-player.html',
344 'only_matching': True,
346 'url': 'http://www.ndr.de/fernsehen/doku952-player.html',
347 'only_matching': True,
351 class NJoyEmbedIE(NDREmbedBaseIE
):
352 IE_NAME
= 'njoy:embed'
353 _VALID_URL
= r
'https?://(?:www\.)?n-joy\.de/(?:[^/]+/)*(?P<id>[\da-z]+)-(?:player|externalPlayer)_[^/]+\.html'
356 'url': 'http://www.n-joy.de/events/reeperbahnfestival/doku948-player_image-bc168e87-5263-4d6d-bd27-bb643005a6de_theme-n-joy.html',
357 'md5': '8483cbfe2320bd4d28a349d62d88bd74',
361 'title': 'Zehn Jahre Reeperbahn Festival - die Doku',
363 'upload_date': '20150807',
368 'url': 'http://www.n-joy.de/news_wissen/stefanrichter100-player_image-d5e938b1-f21a-4b9a-86b8-aaba8bca3a13_theme-n-joy.html',
369 'md5': 'd989f80f28ac954430f7b8a48197188a',
371 'id': 'stefanrichter100',
373 'title': 'Interview mit einem Augenzeugen',
376 'upload_date': '20150909',
380 'skip_download': True,
383 # httpAudioLive, no explicit ext
384 'url': 'http://www.n-joy.de/news_wissen/webradioweltweit100-player_image-3fec0484-2244-4565-8fb8-ed25fd28b173_theme-n-joy.html',
386 'id': 'webradioweltweit100',
388 'title': r
're:^N-JOY Weltweit \d{4}-\d{2}-\d{2} \d{2}:\d{2}$',
391 'upload_date': '20150810',
394 'skip_download': True,
397 'url': 'http://www.n-joy.de/musik/dockville882-player_image-3905259e-0803-4764-ac72-8b7de077d80a_theme-n-joy.html',
398 'only_matching': True,
400 'url': 'http://www.n-joy.de/radio/sendungen/morningshow/urlaubsfotos190-player_image-066a5df1-5c95-49ec-a323-941d848718db_theme-n-joy.html',
401 'only_matching': True,
403 'url': 'http://www.n-joy.de/entertainment/comedy/krudetv290-player_image-ab261bfe-51bf-4bf3-87ba-c5122ee35b3d_theme-n-joy.html',
404 'only_matching': True,