]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/npo.py
[npo] Capture and output error message
[yt-dlp.git] / youtube_dl / extractor / npo.py
CommitLineData
331ae266
JMF
1from __future__ import unicode_literals
2
525daedd
S
3import re
4
171ca612 5from .common import InfoExtractor
83e8fce6
S
6from ..compat import (
7 compat_HTTPError,
8 compat_str,
9)
331ae266 10from ..utils import (
83e8fce6
S
11 determine_ext,
12 ExtractorError,
5c4a81d9 13 fix_xml_ampersands,
5742c18b 14 orderedSet,
944a3de2 15 parse_duration,
c9ea760e 16 qualities,
609a61e3 17 strip_jsonp,
5c4a81d9 18 unified_strdate,
331ae266
JMF
19)
20
21
b9b42f2e 22class NPOBaseIE(InfoExtractor):
04e0bac2 23 def _get_token(self, video_id):
aa9cc2ec
S
24 return self._download_json(
25 'http://ida.omroep.nl/app.php/auth', video_id,
26 note='Downloading token')['token']
04e0bac2
S
27
28
29class NPOIE(NPOBaseIE):
e118031e 30 IE_NAME = 'npo'
359aa2fd 31 IE_DESC = 'npo.nl, ntr.nl, omroepwnl.nl, zapp.nl and npo3.nl'
525daedd 32 _VALID_URL = r'''(?x)
03f32a7e
S
33 (?:
34 npo:|
35 https?://
36 (?:www\.)?
37 (?:
7dd5415c 38 npo\.nl/(?!(?:live|radio)/)(?:[^/]+/){2}|
03f32a7e 39 ntr\.nl/(?:[^/]+/){2,}|
f264c623 40 omroepwnl\.nl/video/fragment/[^/]+__|
359aa2fd 41 (?:zapp|npo3)\.nl/(?:[^/]+/){2}
03f32a7e 42 )
525daedd
S
43 )
44 (?P<id>[^/?#]+)
45 '''
331ae266 46
83e8fce6
S
47 _TESTS = [{
48 'url': 'http://www.npo.nl/nieuwsuur/22-06-2014/VPWON_1220719',
49 'md5': '4b3f9c429157ec4775f2c9cb7b911016',
50 'info_dict': {
51 'id': 'VPWON_1220719',
52 'ext': 'm4v',
53 'title': 'Nieuwsuur',
54 'description': 'Dagelijks tussen tien en elf: nieuws, sport en achtergronden.',
55 'upload_date': '20140622',
331ae266 56 },
83e8fce6
S
57 }, {
58 'url': 'http://www.npo.nl/de-mega-mike-mega-thomas-show/27-02-2009/VARA_101191800',
59 'md5': 'da50a5787dbfc1603c4ad80f31c5120b',
60 'info_dict': {
61 'id': 'VARA_101191800',
62 'ext': 'm4v',
63 'title': 'De Mega Mike & Mega Thomas show: The best of.',
64 'description': 'md5:3b74c97fc9d6901d5a665aac0e5400f4',
65 'upload_date': '20090227',
66 'duration': 2400,
944a3de2 67 },
83e8fce6
S
68 }, {
69 'url': 'http://www.npo.nl/tegenlicht/25-02-2013/VPWON_1169289',
70 'md5': 'f8065e4e5a7824068ed3c7e783178f2c',
71 'info_dict': {
72 'id': 'VPWON_1169289',
73 'ext': 'm4v',
74 'title': 'Tegenlicht: Zwart geld. De toekomst komt uit Afrika',
75 'description': 'md5:52cf4eefbc96fffcbdc06d024147abea',
76 'upload_date': '20130225',
77 'duration': 3000,
1ff30d7b 78 },
83e8fce6
S
79 }, {
80 'url': 'http://www.npo.nl/de-nieuwe-mens-deel-1/21-07-2010/WO_VPRO_043706',
81 'info_dict': {
82 'id': 'WO_VPRO_043706',
83 'ext': 'm4v',
84 'title': 'De nieuwe mens - Deel 1',
85 'description': 'md5:518ae51ba1293ffb80d8d8ce90b74e4b',
86 'duration': 4680,
1ff30d7b 87 },
83e8fce6
S
88 'params': {
89 'skip_download': True,
90 }
91 }, {
c85f3683 92 # non asf in streams
83e8fce6
S
93 'url': 'http://www.npo.nl/hoe-gaat-europa-verder-na-parijs/10-01-2015/WO_NOS_762771',
94 'info_dict': {
95 'id': 'WO_NOS_762771',
96 'ext': 'mp4',
97 'title': 'Hoe gaat Europa verder na Parijs?',
f264c623 98 },
83e8fce6
S
99 'params': {
100 'skip_download': True,
101 }
102 }, {
103 'url': 'http://www.ntr.nl/Aap-Poot-Pies/27/detail/Aap-poot-pies/VPWON_1233944#content',
104 'info_dict': {
105 'id': 'VPWON_1233944',
106 'ext': 'm4v',
107 'title': 'Aap, poot, pies',
108 'description': 'md5:c9c8005d1869ae65b858e82c01a91fde',
109 'upload_date': '20150508',
110 'duration': 599,
f264c623 111 },
83e8fce6
S
112 'params': {
113 'skip_download': True,
114 }
115 }, {
116 'url': 'http://www.omroepwnl.nl/video/fragment/vandaag-de-dag-verkiezingen__POMS_WNL_853698',
117 'info_dict': {
118 'id': 'POW_00996502',
119 'ext': 'm4v',
120 'title': '''"Dit is wel een 'landslide'..."''',
121 'description': 'md5:f8d66d537dfb641380226e31ca57b8e8',
122 'upload_date': '20150508',
123 'duration': 462,
18abb743 124 },
83e8fce6
S
125 'params': {
126 'skip_download': True,
e118031e 127 }
4b8a984c
S
128 }, {
129 # audio
130 'url': 'http://www.npo.nl/jouw-stad-rotterdam/29-01-2017/RBX_FUNX_6683215/RBX_FUNX_7601437',
131 'info_dict': {
132 'id': 'RBX_FUNX_6683215',
133 'ext': 'mp3',
134 'title': 'Jouw Stad Rotterdam',
135 'description': 'md5:db251505244f097717ec59fabc372d9f',
136 },
137 'params': {
138 'skip_download': True,
139 }
83e8fce6
S
140 }, {
141 'url': 'http://www.zapp.nl/de-bzt-show/gemist/KN_1687547',
142 'only_matching': True,
143 }, {
144 'url': 'http://www.zapp.nl/de-bzt-show/filmpjes/POMS_KN_7315118',
145 'only_matching': True,
146 }, {
147 'url': 'http://www.zapp.nl/beste-vrienden-quiz/extra-video-s/WO_NTR_1067990',
148 'only_matching': True,
359aa2fd 149 }, {
150 'url': 'https://www.npo3.nl/3onderzoekt/16-09-2015/VPWON_1239870',
151 'only_matching': True,
83e8fce6
S
152 }, {
153 # live stream
154 'url': 'npo:LI_NL1_4188102',
155 'only_matching': True,
7dd5415c
S
156 }, {
157 'url': 'http://www.npo.nl/radio-gaga/13-06-2017/BNN_101383373',
158 'only_matching': True,
83e8fce6 159 }]
331ae266
JMF
160
161 def _real_extract(self, url):
04e0bac2 162 video_id = self._match_id(url)
d0df9292 163 return self._get_info(video_id)
331ae266 164
d0df9292 165 def _get_info(self, video_id):
331ae266 166 metadata = self._download_json(
8d06a624 167 'http://e.omroep.nl/metadata/%s' % video_id,
331ae266
JMF
168 video_id,
169 # We have to remove the javascript callback
609a61e3 170 transform_source=strip_jsonp,
331ae266 171 )
04e0bac2 172
b8adcec4
S
173 error = metadata.get('error')
174 if error:
175 raise ExtractorError(error, expected=True)
176
525daedd
S
177 # For some videos actual video id (prid) is different (e.g. for
178 # http://www.omroepwnl.nl/video/fragment/vandaag-de-dag-verkiezingen__POMS_WNL_853698
179 # video id is POMS_WNL_853698 but prid is POW_00996502)
180 video_id = metadata.get('prid') or video_id
181
23fc384f
S
182 # titel is too generic in some cases so utilize aflevering_titel as well
183 # when available (e.g. http://tegenlicht.vpro.nl/afleveringen/2014-2015/access-to-africa.html)
184 title = metadata['titel']
185 sub_title = metadata.get('aflevering_titel')
186 if sub_title and sub_title != title:
187 title += ': %s' % sub_title
188
04e0bac2 189 token = self._get_token(video_id)
331ae266 190
c9ea760e 191 formats = []
83e8fce6
S
192 urls = set()
193
194 quality = qualities(['adaptive', 'wmv_sb', 'h264_sb', 'wmv_bb', 'h264_bb', 'wvc1_std', 'h264_std'])
195 items = self._download_json(
196 'http://ida.omroep.nl/app.php/%s' % video_id, video_id,
197 'Downloading formats JSON', query={
198 'adaptive': 'yes',
199 'token': token,
200 })['items'][0]
201 for num, item in enumerate(items):
202 item_url = item.get('url')
203 if not item_url or item_url in urls:
204 continue
205 urls.add(item_url)
206 format_id = self._search_regex(
207 r'video/ida/([^/]+)', item_url, 'format id',
208 default=None)
209
210 def add_format_url(format_url):
211 formats.append({
212 'url': format_url,
213 'format_id': format_id,
214 'quality': quality(format_id),
215 })
1ff30d7b 216
83e8fce6 217 # Example: http://www.npo.nl/de-nieuwe-mens-deel-1/21-07-2010/WO_VPRO_043706
4b8a984c 218 if item.get('contentType') in ('url', 'audio'):
83e8fce6
S
219 add_format_url(item_url)
220 continue
221
222 try:
223 stream_info = self._download_json(
224 item_url + '&type=json', video_id,
225 'Downloading %s stream JSON'
4b8a984c 226 % item.get('label') or item.get('format') or format_id or num)
83e8fce6
S
227 except ExtractorError as ee:
228 if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 404:
229 error = (self._parse_json(
230 ee.cause.read().decode(), video_id,
231 fatal=False) or {}).get('errorstring')
232 if error:
233 raise ExtractorError(error, expected=True)
234 raise
235 # Stream URL instead of JSON, example: npo:LI_NL1_4188102
236 if isinstance(stream_info, compat_str):
237 if not stream_info.startswith('http'):
aa9cc2ec 238 continue
83e8fce6
S
239 video_url = stream_info
240 # JSON
241 else:
aa9cc2ec 242 video_url = stream_info.get('url')
83e8fce6
S
243 if not video_url or video_url in urls:
244 continue
245 urls.add(item_url)
246 if determine_ext(video_url) == 'm3u8':
247 formats.extend(self._extract_m3u8_formats(
248 video_url, video_id, ext='mp4',
249 entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
250 else:
251 add_format_url(video_url)
252
253 is_live = metadata.get('medium') == 'live'
254
255 if not is_live:
256 for num, stream in enumerate(metadata.get('streams', [])):
257 stream_url = stream.get('url')
258 if not stream_url or stream_url in urls:
1ff30d7b 259 continue
83e8fce6
S
260 urls.add(stream_url)
261 # smooth streaming is not supported
262 stream_type = stream.get('type', '').lower()
263 if stream_type in ['ss', 'ms']:
264 continue
265 if stream_type == 'hds':
266 f4m_formats = self._extract_f4m_formats(
267 stream_url, video_id, fatal=False)
268 # f4m downloader downloads only piece of live stream
269 for f4m_format in f4m_formats:
270 f4m_format['preference'] = -1
271 formats.extend(f4m_formats)
272 elif stream_type == 'hls':
aa9cc2ec 273 formats.extend(self._extract_m3u8_formats(
83e8fce6
S
274 stream_url, video_id, ext='mp4', fatal=False))
275 # Example: http://www.npo.nl/de-nieuwe-mens-deel-1/21-07-2010/WO_VPRO_043706
276 elif '.asf' in stream_url:
277 asx = self._download_xml(
278 stream_url, video_id,
279 'Downloading stream %d ASX playlist' % num,
280 transform_source=fix_xml_ampersands, fatal=False)
281 if not asx:
282 continue
283 ref = asx.find('./ENTRY/Ref')
284 if ref is None:
285 continue
286 video_url = ref.get('href')
287 if not video_url or video_url in urls:
288 continue
289 urls.add(video_url)
1ff30d7b
S
290 formats.append({
291 'url': video_url,
83e8fce6
S
292 'ext': stream.get('formaat', 'asf'),
293 'quality': stream.get('kwaliteit'),
294 'preference': -10,
1ff30d7b 295 })
83e8fce6 296 else:
a0977064
S
297 formats.append({
298 'url': stream_url,
299 'quality': stream.get('kwaliteit'),
300 })
1ff30d7b 301
9e91449c 302 self._sort_formats(formats)
25e5ebf3 303
9e91449c
S
304 subtitles = {}
305 if metadata.get('tt888') == 'ja':
b9b42f2e
JMF
306 subtitles['nl'] = [{
307 'ext': 'vtt',
56fc078d 308 'url': 'http://tt888.omroep.nl/tt888/%s' % video_id,
b9b42f2e 309 }]
331ae266
JMF
310
311 return {
312 'id': video_id,
83e8fce6 313 'title': self._live_title(title) if is_live else title,
536b0700 314 'description': metadata.get('info'),
944a3de2
S
315 'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
316 'upload_date': unified_strdate(metadata.get('gidsdatum')),
317 'duration': parse_duration(metadata.get('tijdsduur')),
c9ea760e 318 'formats': formats,
25e5ebf3 319 'subtitles': subtitles,
83e8fce6 320 'is_live': is_live,
331ae266 321 }
d0df9292
JMF
322
323
04e0bac2
S
324class NPOLiveIE(NPOBaseIE):
325 IE_NAME = 'npo.nl:live'
04e431cf 326 _VALID_URL = r'https?://(?:www\.)?npo\.nl/live(?:/(?P<id>[^/?#&]+))?'
04e0bac2 327
1591ba25 328 _TESTS = [{
04e0bac2
S
329 'url': 'http://www.npo.nl/live/npo-1',
330 'info_dict': {
83e8fce6 331 'id': 'LI_NL1_4188102',
04e0bac2
S
332 'display_id': 'npo-1',
333 'ext': 'mp4',
83e8fce6 334 'title': 're:^NPO 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
04e0bac2
S
335 'is_live': True,
336 },
337 'params': {
338 'skip_download': True,
339 }
1591ba25
AG
340 }, {
341 'url': 'http://www.npo.nl/live',
04e431cf 342 'only_matching': True,
1591ba25 343 }]
04e0bac2
S
344
345 def _real_extract(self, url):
1591ba25 346 display_id = self._match_id(url) or 'npo-1'
04e0bac2
S
347
348 webpage = self._download_webpage(url, display_id)
349
350 live_id = self._search_regex(
7a577309 351 [r'media-id="([^"]+)"', r'data-prid="([^"]+)"'], webpage, 'live id')
04e0bac2 352
04e0bac2 353 return {
83e8fce6
S
354 '_type': 'url_transparent',
355 'url': 'npo:%s' % live_id,
356 'ie_key': NPOIE.ie_key(),
04e0bac2
S
357 'id': live_id,
358 'display_id': display_id,
04e0bac2
S
359 }
360
361
171ca612
S
362class NPORadioIE(InfoExtractor):
363 IE_NAME = 'npo.nl:radio'
364 _VALID_URL = r'https?://(?:www\.)?npo\.nl/radio/(?P<id>[^/]+)/?$'
365
366 _TEST = {
367 'url': 'http://www.npo.nl/radio/radio-1',
368 'info_dict': {
369 'id': 'radio-1',
370 'ext': 'mp3',
371 'title': 're:^NPO Radio 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
372 'is_live': True,
373 },
374 'params': {
375 'skip_download': True,
376 }
377 }
378
379 @staticmethod
380 def _html_get_attribute_regex(attribute):
381 return r'{0}\s*=\s*\'([^\']+)\''.format(attribute)
382
383 def _real_extract(self, url):
384 video_id = self._match_id(url)
385
386 webpage = self._download_webpage(url, video_id)
387
388 title = self._html_search_regex(
389 self._html_get_attribute_regex('data-channel'), webpage, 'title')
390
391 stream = self._parse_json(
392 self._html_search_regex(self._html_get_attribute_regex('data-streams'), webpage, 'data-streams'),
393 video_id)
394
395 codec = stream.get('codec')
396
397 return {
398 'id': video_id,
399 'url': stream['url'],
400 'title': self._live_title(title),
401 'acodec': codec,
402 'ext': codec,
403 'is_live': True,
404 }
405
406
407class NPORadioFragmentIE(InfoExtractor):
408 IE_NAME = 'npo.nl:radio:fragment'
409 _VALID_URL = r'https?://(?:www\.)?npo\.nl/radio/[^/]+/fragment/(?P<id>\d+)'
410
411 _TEST = {
412 'url': 'http://www.npo.nl/radio/radio-5/fragment/174356',
413 'md5': 'dd8cc470dad764d0fdc70a9a1e2d18c2',
414 'info_dict': {
415 'id': '174356',
416 'ext': 'mp3',
417 'title': 'Jubileumconcert Willeke Alberti',
418 },
419 }
420
421 def _real_extract(self, url):
422 audio_id = self._match_id(url)
423
424 webpage = self._download_webpage(url, audio_id)
425
426 title = self._html_search_regex(
427 r'href="/radio/[^/]+/fragment/%s" title="([^"]+)"' % audio_id,
428 webpage, 'title')
429
430 audio_url = self._search_regex(
431 r"data-streams='([^']+)'", webpage, 'audio url')
432
433 return {
434 'id': audio_id,
435 'url': audio_url,
436 'title': title,
437 }
438
439
0dc5a86a
S
440class NPODataMidEmbedIE(InfoExtractor):
441 def _real_extract(self, url):
442 display_id = self._match_id(url)
443 webpage = self._download_webpage(url, display_id)
444 video_id = self._search_regex(
445 r'data-mid=(["\'])(?P<id>(?:(?!\1).)+)\1', webpage, 'video_id', group='id')
446 return {
447 '_type': 'url_transparent',
448 'ie_key': 'NPO',
449 'url': 'npo:%s' % video_id,
450 'display_id': display_id
451 }
452
453
454class SchoolTVIE(NPODataMidEmbedIE):
89f26028 455 IE_NAME = 'schooltv'
456 _VALID_URL = r'https?://(?:www\.)?schooltv\.nl/video/(?P<id>[^/?#&]+)'
457
458 _TEST = {
459 'url': 'http://www.schooltv.nl/video/ademhaling-de-hele-dag-haal-je-adem-maar-wat-gebeurt-er-dan-eigenlijk-in-je-lichaam/',
460 'info_dict': {
461 'id': 'WO_NTR_429477',
462 'display_id': 'ademhaling-de-hele-dag-haal-je-adem-maar-wat-gebeurt-er-dan-eigenlijk-in-je-lichaam',
463 'title': 'Ademhaling: De hele dag haal je adem. Maar wat gebeurt er dan eigenlijk in je lichaam?',
464 'ext': 'mp4',
465 'description': 'md5:abfa0ff690adb73fd0297fd033aaa631'
466 },
467 'params': {
468 # Skip because of m3u8 download
469 'skip_download': True
470 }
471 }
472
0dc5a86a
S
473
474class HetKlokhuisIE(NPODataMidEmbedIE):
dbc01fdb 475 IE_NAME = 'hetklokhuis'
197224b7 476 _VALID_URL = r'https?://(?:www\.)?hetklokhuis\.nl/[^/]+/\d+/(?P<id>[^/?#&]+)'
0dc5a86a
S
477
478 _TEST = {
479 'url': 'http://hetklokhuis.nl/tv-uitzending/3471/Zwaartekrachtsgolven',
480 'info_dict': {
481 'id': 'VPWON_1260528',
482 'display_id': 'Zwaartekrachtsgolven',
483 'ext': 'm4v',
484 'title': 'Het Klokhuis: Zwaartekrachtsgolven',
485 'description': 'md5:c94f31fb930d76c2efa4a4a71651dd48',
486 'upload_date': '20170223',
487 },
488 'params': {
489 'skip_download': True
89f26028 490 }
0dc5a86a 491 }
89f26028 492
493
a3d8b381
S
494class NPOPlaylistBaseIE(NPOIE):
495 def _real_extract(self, url):
496 playlist_id = self._match_id(url)
497
498 webpage = self._download_webpage(url, playlist_id)
499
500 entries = [
501 self.url_result('npo:%s' % video_id if not video_id.startswith('http') else video_id)
5742c18b 502 for video_id in orderedSet(re.findall(self._PLAYLIST_ENTRY_RE, webpage))
a3d8b381
S
503 ]
504
505 playlist_title = self._html_search_regex(
506 self._PLAYLIST_TITLE_RE, webpage, 'playlist title',
507 default=None) or self._og_search_title(webpage)
508
509 return self.playlist_result(entries, playlist_id, playlist_title)
510
511
512class VPROIE(NPOPlaylistBaseIE):
464e7924 513 IE_NAME = 'vpro'
b1d79888
S
514 _VALID_URL = r'https?://(?:www\.)?(?:(?:tegenlicht\.)?vpro|2doc)\.nl/(?:[^/]+/)*(?P<id>[^/]+)\.html'
515 _PLAYLIST_TITLE_RE = (r'<h1[^>]+class=["\'].*?\bmedia-platform-title\b.*?["\'][^>]*>([^<]+)',
516 r'<h5[^>]+class=["\'].*?\bmedia-platform-subtitle\b.*?["\'][^>]*>([^<]+)')
a3d8b381 517 _PLAYLIST_ENTRY_RE = r'data-media-id="([^"]+)"'
d0df9292
JMF
518
519 _TESTS = [
520 {
521 'url': 'http://tegenlicht.vpro.nl/afleveringen/2012-2013/de-toekomst-komt-uit-afrika.html',
522 'md5': 'f8065e4e5a7824068ed3c7e783178f2c',
523 'info_dict': {
524 'id': 'VPWON_1169289',
525 'ext': 'm4v',
5ba761eb 526 'title': 'De toekomst komt uit Afrika',
611ac379 527 'description': 'md5:52cf4eefbc96fffcbdc06d024147abea',
d0df9292
JMF
528 'upload_date': '20130225',
529 },
ddb19772 530 'skip': 'Video gone',
d0df9292 531 },
611ac379
S
532 {
533 'url': 'http://www.vpro.nl/programmas/2doc/2015/sergio-herman.html',
534 'info_dict': {
535 'id': 'sergio-herman',
ddb19772 536 'title': 'sergio herman: fucking perfect',
611ac379
S
537 },
538 'playlist_count': 2,
574f42d7
S
539 },
540 {
541 # playlist with youtube embed
542 'url': 'http://www.vpro.nl/programmas/2doc/2015/education-education.html',
543 'info_dict': {
544 'id': 'education-education',
ddb19772 545 'title': 'education education',
574f42d7
S
546 },
547 'playlist_count': 2,
b1d79888
S
548 },
549 {
550 'url': 'http://www.2doc.nl/documentaires/series/2doc/2015/oktober/de-tegenprestatie.html',
551 'info_dict': {
552 'id': 'de-tegenprestatie',
553 'title': 'De Tegenprestatie',
554 },
555 'playlist_count': 2,
556 }, {
557 'url': 'http://www.2doc.nl/speel~VARA_101375237~mh17-het-verdriet-van-nederland~.html',
558 'info_dict': {
559 'id': 'VARA_101375237',
560 'ext': 'm4v',
561 'title': 'MH17: Het verdriet van Nederland',
562 'description': 'md5:09e1a37c1fdb144621e22479691a9f18',
563 'upload_date': '20150716',
564 },
565 'params': {
566 # Skip because of m3u8 download
567 'skip_download': True
568 },
611ac379 569 }
d0df9292
JMF
570 ]
571
03f32a7e 572
a3d8b381 573class WNLIE(NPOPlaylistBaseIE):
f9dd86a1 574 IE_NAME = 'wnl'
03f32a7e 575 _VALID_URL = r'https?://(?:www\.)?omroepwnl\.nl/video/detail/(?P<id>[^/]+)__\d+'
a3d8b381
S
576 _PLAYLIST_TITLE_RE = r'(?s)<h1[^>]+class="subject"[^>]*>(.+?)</h1>'
577 _PLAYLIST_ENTRY_RE = r'<a[^>]+href="([^"]+)"[^>]+class="js-mid"[^>]*>Deel \d+'
03f32a7e 578
a3d8b381 579 _TESTS = [{
03f32a7e
S
580 'url': 'http://www.omroepwnl.nl/video/detail/vandaag-de-dag-6-mei__060515',
581 'info_dict': {
582 'id': 'vandaag-de-dag-6-mei',
583 'title': 'Vandaag de Dag 6 mei',
584 },
585 'playlist_count': 4,
a3d8b381 586 }]
5742c18b
S
587
588
589class AndereTijdenIE(NPOPlaylistBaseIE):
f9dd86a1 590 IE_NAME = 'anderetijden'
5742c18b
S
591 _VALID_URL = r'https?://(?:www\.)?anderetijden\.nl/programma/(?:[^/]+/)+(?P<id>[^/?#&]+)'
592 _PLAYLIST_TITLE_RE = r'(?s)<h1[^>]+class=["\'].*?\bpage-title\b.*?["\'][^>]*>(.+?)</h1>'
593 _PLAYLIST_ENTRY_RE = r'<figure[^>]+class=["\']episode-container episode-page["\'][^>]+data-prid=["\'](.+?)["\']'
594
595 _TESTS = [{
596 'url': 'http://anderetijden.nl/programma/1/Andere-Tijden/aflevering/676/Duitse-soldaten-over-de-Slag-bij-Arnhem',
597 'info_dict': {
598 'id': 'Duitse-soldaten-over-de-Slag-bij-Arnhem',
599 'title': 'Duitse soldaten over de Slag bij Arnhem',
600 },
601 'playlist_count': 3,
602 }]