]>
Commit | Line | Data |
---|---|---|
331ae266 JMF |
1 | from __future__ import unicode_literals |
2 | ||
525daedd S |
3 | import re |
4 | ||
171ca612 | 5 | from .common import InfoExtractor |
331ae266 | 6 | from ..utils import ( |
5c4a81d9 | 7 | fix_xml_ampersands, |
5742c18b | 8 | orderedSet, |
944a3de2 | 9 | parse_duration, |
c9ea760e | 10 | qualities, |
609a61e3 | 11 | strip_jsonp, |
5c4a81d9 | 12 | unified_strdate, |
331ae266 JMF |
13 | ) |
14 | ||
15 | ||
b9b42f2e | 16 | class NPOBaseIE(InfoExtractor): |
04e0bac2 S |
17 | def _get_token(self, video_id): |
18 | token_page = self._download_webpage( | |
19 | 'http://ida.omroep.nl/npoplayer/i.js', | |
20 | video_id, note='Downloading token') | |
8d06a624 | 21 | token = self._search_regex( |
04e0bac2 | 22 | r'npoplayer\.token = "(.+?)"', token_page, 'token') |
f5ca97e3 | 23 | # Decryption algorithm extracted from http://npoplayer.omroep.nl/csjs/npoplayer-min.js |
8d06a624 YCH |
24 | token_l = list(token) |
25 | first = second = None | |
26 | for i in range(5, len(token_l) - 4): | |
27 | if token_l[i].isdigit(): | |
28 | if first is None: | |
29 | first = i | |
30 | elif second is None: | |
31 | second = i | |
32 | if first is None or second is None: | |
33 | first = 12 | |
34 | second = 13 | |
35 | ||
36 | token_l[first], token_l[second] = token_l[second], token_l[first] | |
37 | ||
38 | return ''.join(token_l) | |
04e0bac2 S |
39 | |
40 | ||
41 | class NPOIE(NPOBaseIE): | |
e118031e S |
42 | IE_NAME = 'npo' |
43 | IE_DESC = 'npo.nl and ntr.nl' | |
525daedd | 44 | _VALID_URL = r'''(?x) |
03f32a7e S |
45 | (?: |
46 | npo:| | |
47 | https?:// | |
48 | (?:www\.)? | |
49 | (?: | |
50 | npo\.nl/(?!live|radio)(?:[^/]+/){2}| | |
51 | ntr\.nl/(?:[^/]+/){2,}| | |
52 | omroepwnl\.nl/video/fragment/[^/]+__ | |
53 | ) | |
525daedd S |
54 | ) |
55 | (?P<id>[^/?#]+) | |
56 | ''' | |
331ae266 | 57 | |
944a3de2 S |
58 | _TESTS = [ |
59 | { | |
60 | 'url': 'http://www.npo.nl/nieuwsuur/22-06-2014/VPWON_1220719', | |
61 | 'md5': '4b3f9c429157ec4775f2c9cb7b911016', | |
62 | 'info_dict': { | |
63 | 'id': 'VPWON_1220719', | |
64 | 'ext': 'm4v', | |
65 | 'title': 'Nieuwsuur', | |
66 | 'description': 'Dagelijks tussen tien en elf: nieuws, sport en achtergronden.', | |
67 | 'upload_date': '20140622', | |
68 | }, | |
331ae266 | 69 | }, |
944a3de2 S |
70 | { |
71 | 'url': 'http://www.npo.nl/de-mega-mike-mega-thomas-show/27-02-2009/VARA_101191800', | |
72 | 'md5': 'da50a5787dbfc1603c4ad80f31c5120b', | |
73 | 'info_dict': { | |
74 | 'id': 'VARA_101191800', | |
75 | 'ext': 'm4v', | |
23fc384f | 76 | 'title': 'De Mega Mike & Mega Thomas show: The best of.', |
944a3de2 S |
77 | 'description': 'md5:3b74c97fc9d6901d5a665aac0e5400f4', |
78 | 'upload_date': '20090227', | |
79 | 'duration': 2400, | |
80 | }, | |
81 | }, | |
82 | { | |
83 | 'url': 'http://www.npo.nl/tegenlicht/25-02-2013/VPWON_1169289', | |
84 | 'md5': 'f8065e4e5a7824068ed3c7e783178f2c', | |
85 | 'info_dict': { | |
86 | 'id': 'VPWON_1169289', | |
87 | 'ext': 'm4v', | |
23fc384f | 88 | 'title': 'Tegenlicht: De toekomst komt uit Afrika', |
50ea2bb2 | 89 | 'description': 'md5:52cf4eefbc96fffcbdc06d024147abea', |
944a3de2 S |
90 | 'upload_date': '20130225', |
91 | 'duration': 3000, | |
92 | }, | |
1ff30d7b S |
93 | }, |
94 | { | |
95 | 'url': 'http://www.npo.nl/de-nieuwe-mens-deel-1/21-07-2010/WO_VPRO_043706', | |
96 | 'info_dict': { | |
97 | 'id': 'WO_VPRO_043706', | |
98 | 'ext': 'wmv', | |
99 | 'title': 'De nieuwe mens - Deel 1', | |
100 | 'description': 'md5:518ae51ba1293ffb80d8d8ce90b74e4b', | |
101 | 'duration': 4680, | |
102 | }, | |
103 | 'params': { | |
104 | # mplayer mms download | |
105 | 'skip_download': True, | |
106 | } | |
107 | }, | |
c85f3683 S |
108 | # non asf in streams |
109 | { | |
110 | 'url': 'http://www.npo.nl/hoe-gaat-europa-verder-na-parijs/10-01-2015/WO_NOS_762771', | |
111 | 'md5': 'b3da13de374cbe2d5332a7e910bef97f', | |
112 | 'info_dict': { | |
113 | 'id': 'WO_NOS_762771', | |
114 | 'ext': 'mp4', | |
115 | 'title': 'Hoe gaat Europa verder na Parijs?', | |
116 | }, | |
117 | }, | |
e118031e S |
118 | { |
119 | 'url': 'http://www.ntr.nl/Aap-Poot-Pies/27/detail/Aap-poot-pies/VPWON_1233944#content', | |
120 | 'md5': '01c6a2841675995da1f0cf776f03a9c3', | |
121 | 'info_dict': { | |
122 | 'id': 'VPWON_1233944', | |
123 | 'ext': 'm4v', | |
124 | 'title': 'Aap, poot, pies', | |
125 | 'description': 'md5:c9c8005d1869ae65b858e82c01a91fde', | |
126 | 'upload_date': '20150508', | |
127 | 'duration': 599, | |
128 | }, | |
525daedd S |
129 | }, |
130 | { | |
131 | 'url': 'http://www.omroepwnl.nl/video/fragment/vandaag-de-dag-verkiezingen__POMS_WNL_853698', | |
132 | 'md5': 'd30cd8417b8b9bca1fdff27428860d08', | |
133 | 'info_dict': { | |
134 | 'id': 'POW_00996502', | |
135 | 'ext': 'm4v', | |
136 | 'title': '''"Dit is wel een 'landslide'..."''', | |
137 | 'description': 'md5:f8d66d537dfb641380226e31ca57b8e8', | |
138 | 'upload_date': '20150508', | |
139 | 'duration': 462, | |
140 | }, | |
e118031e | 141 | } |
944a3de2 | 142 | ] |
331ae266 JMF |
143 | |
144 | def _real_extract(self, url): | |
04e0bac2 | 145 | video_id = self._match_id(url) |
d0df9292 | 146 | return self._get_info(video_id) |
331ae266 | 147 | |
d0df9292 | 148 | def _get_info(self, video_id): |
331ae266 | 149 | metadata = self._download_json( |
8d06a624 | 150 | 'http://e.omroep.nl/metadata/%s' % video_id, |
331ae266 JMF |
151 | video_id, |
152 | # We have to remove the javascript callback | |
609a61e3 | 153 | transform_source=strip_jsonp, |
331ae266 | 154 | ) |
04e0bac2 | 155 | |
525daedd S |
156 | # For some videos actual video id (prid) is different (e.g. for |
157 | # http://www.omroepwnl.nl/video/fragment/vandaag-de-dag-verkiezingen__POMS_WNL_853698 | |
158 | # video id is POMS_WNL_853698 but prid is POW_00996502) | |
159 | video_id = metadata.get('prid') or video_id | |
160 | ||
23fc384f S |
161 | # titel is too generic in some cases so utilize aflevering_titel as well |
162 | # when available (e.g. http://tegenlicht.vpro.nl/afleveringen/2014-2015/access-to-africa.html) | |
163 | title = metadata['titel'] | |
164 | sub_title = metadata.get('aflevering_titel') | |
165 | if sub_title and sub_title != title: | |
166 | title += ': %s' % sub_title | |
167 | ||
04e0bac2 | 168 | token = self._get_token(video_id) |
331ae266 | 169 | |
c9ea760e | 170 | formats = [] |
1ff30d7b S |
171 | |
172 | pubopties = metadata.get('pubopties') | |
173 | if pubopties: | |
174 | quality = qualities(['adaptive', 'wmv_sb', 'h264_sb', 'wmv_bb', 'h264_bb', 'wvc1_std', 'h264_std']) | |
175 | for format_id in pubopties: | |
176 | format_info = self._download_json( | |
177 | 'http://ida.omroep.nl/odi/?prid=%s&puboptions=%s&adaptive=yes&token=%s' | |
178 | % (video_id, format_id, token), | |
179 | video_id, 'Downloading %s JSON' % format_id) | |
180 | if format_info.get('error_code', 0) or format_info.get('errorcode', 0): | |
181 | continue | |
182 | streams = format_info.get('streams') | |
183 | if streams: | |
184 | video_info = self._download_json( | |
185 | streams[0] + '&type=json', | |
186 | video_id, 'Downloading %s stream JSON' % format_id) | |
187 | else: | |
188 | video_info = format_info | |
189 | video_url = video_info.get('url') | |
190 | if not video_url: | |
191 | continue | |
192 | if format_id == 'adaptive': | |
a7685b3a | 193 | formats.extend(self._extract_m3u8_formats(video_url, video_id, 'mp4')) |
1ff30d7b S |
194 | else: |
195 | formats.append({ | |
196 | 'url': video_url, | |
197 | 'format_id': format_id, | |
198 | 'quality': quality(format_id), | |
199 | }) | |
200 | ||
201 | streams = metadata.get('streams') | |
202 | if streams: | |
203 | for i, stream in enumerate(streams): | |
204 | stream_url = stream.get('url') | |
205 | if not stream_url: | |
206 | continue | |
5c4a81d9 | 207 | if '.asf' not in stream_url: |
a0977064 S |
208 | formats.append({ |
209 | 'url': stream_url, | |
210 | 'quality': stream.get('kwaliteit'), | |
211 | }) | |
212 | continue | |
1ff30d7b S |
213 | asx = self._download_xml( |
214 | stream_url, video_id, | |
215 | 'Downloading stream %d ASX playlist' % i, | |
216 | transform_source=fix_xml_ampersands) | |
217 | ref = asx.find('./ENTRY/Ref') | |
218 | if ref is None: | |
219 | continue | |
220 | video_url = ref.get('href') | |
221 | if not video_url: | |
222 | continue | |
c9ea760e | 223 | formats.append({ |
944a3de2 | 224 | 'url': video_url, |
1ff30d7b S |
225 | 'ext': stream.get('formaat', 'asf'), |
226 | 'quality': stream.get('kwaliteit'), | |
c9ea760e | 227 | }) |
1ff30d7b | 228 | |
9e91449c | 229 | self._sort_formats(formats) |
25e5ebf3 | 230 | |
9e91449c S |
231 | subtitles = {} |
232 | if metadata.get('tt888') == 'ja': | |
b9b42f2e JMF |
233 | subtitles['nl'] = [{ |
234 | 'ext': 'vtt', | |
235 | 'url': 'http://e.omroep.nl/tt888/%s' % video_id, | |
236 | }] | |
331ae266 JMF |
237 | |
238 | return { | |
239 | 'id': video_id, | |
23fc384f | 240 | 'title': title, |
536b0700 | 241 | 'description': metadata.get('info'), |
944a3de2 S |
242 | 'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'], |
243 | 'upload_date': unified_strdate(metadata.get('gidsdatum')), | |
244 | 'duration': parse_duration(metadata.get('tijdsduur')), | |
c9ea760e | 245 | 'formats': formats, |
25e5ebf3 | 246 | 'subtitles': subtitles, |
331ae266 | 247 | } |
d0df9292 JMF |
248 | |
249 | ||
04e0bac2 S |
250 | class NPOLiveIE(NPOBaseIE): |
251 | IE_NAME = 'npo.nl:live' | |
171ca612 | 252 | _VALID_URL = r'https?://(?:www\.)?npo\.nl/live/(?P<id>.+)' |
04e0bac2 S |
253 | |
254 | _TEST = { | |
255 | 'url': 'http://www.npo.nl/live/npo-1', | |
256 | 'info_dict': { | |
257 | 'id': 'LI_NEDERLAND1_136692', | |
258 | 'display_id': 'npo-1', | |
259 | 'ext': 'mp4', | |
260 | 'title': 're:^Nederland 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', | |
261 | 'description': 'Livestream', | |
262 | 'is_live': True, | |
263 | }, | |
264 | 'params': { | |
265 | 'skip_download': True, | |
266 | } | |
267 | } | |
268 | ||
269 | def _real_extract(self, url): | |
270 | display_id = self._match_id(url) | |
271 | ||
272 | webpage = self._download_webpage(url, display_id) | |
273 | ||
274 | live_id = self._search_regex( | |
275 | r'data-prid="([^"]+)"', webpage, 'live id') | |
276 | ||
277 | metadata = self._download_json( | |
278 | 'http://e.omroep.nl/metadata/%s' % live_id, | |
279 | display_id, transform_source=strip_jsonp) | |
280 | ||
281 | token = self._get_token(display_id) | |
282 | ||
283 | formats = [] | |
284 | ||
285 | streams = metadata.get('streams') | |
286 | if streams: | |
287 | for stream in streams: | |
288 | stream_type = stream.get('type').lower() | |
32aaeca7 S |
289 | # smooth streaming is not supported |
290 | if stream_type in ['ss', 'ms']: | |
04e0bac2 S |
291 | continue |
292 | stream_info = self._download_json( | |
293 | 'http://ida.omroep.nl/aapi/?stream=%s&token=%s&type=jsonp' | |
294 | % (stream.get('url'), token), | |
295 | display_id, 'Downloading %s JSON' % stream_type) | |
296 | if stream_info.get('error_code', 0) or stream_info.get('errorcode', 0): | |
297 | continue | |
298 | stream_url = self._download_json( | |
299 | stream_info['stream'], display_id, | |
300 | 'Downloading %s URL' % stream_type, | |
b0872c19 S |
301 | 'Unable to download %s URL' % stream_type, |
302 | transform_source=strip_jsonp, fatal=False) | |
303 | if not stream_url: | |
304 | continue | |
04e0bac2 S |
305 | if stream_type == 'hds': |
306 | f4m_formats = self._extract_f4m_formats(stream_url, display_id) | |
307 | # f4m downloader downloads only piece of live stream | |
308 | for f4m_format in f4m_formats: | |
309 | f4m_format['preference'] = -1 | |
310 | formats.extend(f4m_formats) | |
311 | elif stream_type == 'hls': | |
312 | formats.extend(self._extract_m3u8_formats(stream_url, display_id, 'mp4')) | |
313 | else: | |
314 | formats.append({ | |
315 | 'url': stream_url, | |
32aaeca7 | 316 | 'preference': -10, |
04e0bac2 S |
317 | }) |
318 | ||
319 | self._sort_formats(formats) | |
320 | ||
321 | return { | |
322 | 'id': live_id, | |
323 | 'display_id': display_id, | |
324 | 'title': self._live_title(metadata['titel']), | |
325 | 'description': metadata['info'], | |
326 | 'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'], | |
327 | 'formats': formats, | |
328 | 'is_live': True, | |
329 | } | |
330 | ||
331 | ||
171ca612 S |
332 | class NPORadioIE(InfoExtractor): |
333 | IE_NAME = 'npo.nl:radio' | |
334 | _VALID_URL = r'https?://(?:www\.)?npo\.nl/radio/(?P<id>[^/]+)/?$' | |
335 | ||
336 | _TEST = { | |
337 | 'url': 'http://www.npo.nl/radio/radio-1', | |
338 | 'info_dict': { | |
339 | 'id': 'radio-1', | |
340 | 'ext': 'mp3', | |
341 | 'title': 're:^NPO Radio 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$', | |
342 | 'is_live': True, | |
343 | }, | |
344 | 'params': { | |
345 | 'skip_download': True, | |
346 | } | |
347 | } | |
348 | ||
349 | @staticmethod | |
350 | def _html_get_attribute_regex(attribute): | |
351 | return r'{0}\s*=\s*\'([^\']+)\''.format(attribute) | |
352 | ||
353 | def _real_extract(self, url): | |
354 | video_id = self._match_id(url) | |
355 | ||
356 | webpage = self._download_webpage(url, video_id) | |
357 | ||
358 | title = self._html_search_regex( | |
359 | self._html_get_attribute_regex('data-channel'), webpage, 'title') | |
360 | ||
361 | stream = self._parse_json( | |
362 | self._html_search_regex(self._html_get_attribute_regex('data-streams'), webpage, 'data-streams'), | |
363 | video_id) | |
364 | ||
365 | codec = stream.get('codec') | |
366 | ||
367 | return { | |
368 | 'id': video_id, | |
369 | 'url': stream['url'], | |
370 | 'title': self._live_title(title), | |
371 | 'acodec': codec, | |
372 | 'ext': codec, | |
373 | 'is_live': True, | |
374 | } | |
375 | ||
376 | ||
377 | class NPORadioFragmentIE(InfoExtractor): | |
378 | IE_NAME = 'npo.nl:radio:fragment' | |
379 | _VALID_URL = r'https?://(?:www\.)?npo\.nl/radio/[^/]+/fragment/(?P<id>\d+)' | |
380 | ||
381 | _TEST = { | |
382 | 'url': 'http://www.npo.nl/radio/radio-5/fragment/174356', | |
383 | 'md5': 'dd8cc470dad764d0fdc70a9a1e2d18c2', | |
384 | 'info_dict': { | |
385 | 'id': '174356', | |
386 | 'ext': 'mp3', | |
387 | 'title': 'Jubileumconcert Willeke Alberti', | |
388 | }, | |
389 | } | |
390 | ||
391 | def _real_extract(self, url): | |
392 | audio_id = self._match_id(url) | |
393 | ||
394 | webpage = self._download_webpage(url, audio_id) | |
395 | ||
396 | title = self._html_search_regex( | |
397 | r'href="/radio/[^/]+/fragment/%s" title="([^"]+)"' % audio_id, | |
398 | webpage, 'title') | |
399 | ||
400 | audio_url = self._search_regex( | |
401 | r"data-streams='([^']+)'", webpage, 'audio url') | |
402 | ||
403 | return { | |
404 | 'id': audio_id, | |
405 | 'url': audio_url, | |
406 | 'title': title, | |
407 | } | |
408 | ||
409 | ||
89f26028 | 410 | class SchoolTVIE(InfoExtractor): |
411 | IE_NAME = 'schooltv' | |
412 | _VALID_URL = r'https?://(?:www\.)?schooltv\.nl/video/(?P<id>[^/?#&]+)' | |
413 | ||
414 | _TEST = { | |
415 | 'url': 'http://www.schooltv.nl/video/ademhaling-de-hele-dag-haal-je-adem-maar-wat-gebeurt-er-dan-eigenlijk-in-je-lichaam/', | |
416 | 'info_dict': { | |
417 | 'id': 'WO_NTR_429477', | |
418 | 'display_id': 'ademhaling-de-hele-dag-haal-je-adem-maar-wat-gebeurt-er-dan-eigenlijk-in-je-lichaam', | |
419 | 'title': 'Ademhaling: De hele dag haal je adem. Maar wat gebeurt er dan eigenlijk in je lichaam?', | |
420 | 'ext': 'mp4', | |
421 | 'description': 'md5:abfa0ff690adb73fd0297fd033aaa631' | |
422 | }, | |
423 | 'params': { | |
424 | # Skip because of m3u8 download | |
425 | 'skip_download': True | |
426 | } | |
427 | } | |
428 | ||
429 | def _real_extract(self, url): | |
430 | display_id = self._match_id(url) | |
431 | webpage = self._download_webpage(url, display_id) | |
673fb82e | 432 | video_id = self._search_regex( |
490b7557 | 433 | r'data-mid=(["\'])(?P<id>(?:(?!\1).)+)\1', webpage, 'video_id', group='id') |
89f26028 | 434 | return { |
435 | '_type': 'url_transparent', | |
436 | 'ie_key': 'NPO', | |
437 | 'url': 'npo:%s' % video_id, | |
438 | 'display_id': display_id | |
439 | } | |
440 | ||
441 | ||
a3d8b381 S |
442 | class NPOPlaylistBaseIE(NPOIE): |
443 | def _real_extract(self, url): | |
444 | playlist_id = self._match_id(url) | |
445 | ||
446 | webpage = self._download_webpage(url, playlist_id) | |
447 | ||
448 | entries = [ | |
449 | self.url_result('npo:%s' % video_id if not video_id.startswith('http') else video_id) | |
5742c18b | 450 | for video_id in orderedSet(re.findall(self._PLAYLIST_ENTRY_RE, webpage)) |
a3d8b381 S |
451 | ] |
452 | ||
453 | playlist_title = self._html_search_regex( | |
454 | self._PLAYLIST_TITLE_RE, webpage, 'playlist title', | |
455 | default=None) or self._og_search_title(webpage) | |
456 | ||
457 | return self.playlist_result(entries, playlist_id, playlist_title) | |
458 | ||
459 | ||
460 | class VPROIE(NPOPlaylistBaseIE): | |
464e7924 | 461 | IE_NAME = 'vpro' |
611ac379 | 462 | _VALID_URL = r'https?://(?:www\.)?(?:tegenlicht\.)?vpro\.nl/(?:[^/]+/){2,}(?P<id>[^/]+)\.html' |
ddb19772 | 463 | _PLAYLIST_TITLE_RE = r'<h1[^>]+class=["\'].*?\bmedia-platform-title\b.*?["\'][^>]*>([^<]+)' |
a3d8b381 | 464 | _PLAYLIST_ENTRY_RE = r'data-media-id="([^"]+)"' |
d0df9292 JMF |
465 | |
466 | _TESTS = [ | |
467 | { | |
468 | 'url': 'http://tegenlicht.vpro.nl/afleveringen/2012-2013/de-toekomst-komt-uit-afrika.html', | |
469 | 'md5': 'f8065e4e5a7824068ed3c7e783178f2c', | |
470 | 'info_dict': { | |
471 | 'id': 'VPWON_1169289', | |
472 | 'ext': 'm4v', | |
5ba761eb | 473 | 'title': 'De toekomst komt uit Afrika', |
611ac379 | 474 | 'description': 'md5:52cf4eefbc96fffcbdc06d024147abea', |
d0df9292 JMF |
475 | 'upload_date': '20130225', |
476 | }, | |
ddb19772 | 477 | 'skip': 'Video gone', |
d0df9292 | 478 | }, |
611ac379 S |
479 | { |
480 | 'url': 'http://www.vpro.nl/programmas/2doc/2015/sergio-herman.html', | |
481 | 'info_dict': { | |
482 | 'id': 'sergio-herman', | |
ddb19772 | 483 | 'title': 'sergio herman: fucking perfect', |
611ac379 S |
484 | }, |
485 | 'playlist_count': 2, | |
574f42d7 S |
486 | }, |
487 | { | |
488 | # playlist with youtube embed | |
489 | 'url': 'http://www.vpro.nl/programmas/2doc/2015/education-education.html', | |
490 | 'info_dict': { | |
491 | 'id': 'education-education', | |
ddb19772 | 492 | 'title': 'education education', |
574f42d7 S |
493 | }, |
494 | 'playlist_count': 2, | |
611ac379 | 495 | } |
d0df9292 JMF |
496 | ] |
497 | ||
03f32a7e | 498 | |
a3d8b381 | 499 | class WNLIE(NPOPlaylistBaseIE): |
f9dd86a1 | 500 | IE_NAME = 'wnl' |
03f32a7e | 501 | _VALID_URL = r'https?://(?:www\.)?omroepwnl\.nl/video/detail/(?P<id>[^/]+)__\d+' |
a3d8b381 S |
502 | _PLAYLIST_TITLE_RE = r'(?s)<h1[^>]+class="subject"[^>]*>(.+?)</h1>' |
503 | _PLAYLIST_ENTRY_RE = r'<a[^>]+href="([^"]+)"[^>]+class="js-mid"[^>]*>Deel \d+' | |
03f32a7e | 504 | |
a3d8b381 | 505 | _TESTS = [{ |
03f32a7e S |
506 | 'url': 'http://www.omroepwnl.nl/video/detail/vandaag-de-dag-6-mei__060515', |
507 | 'info_dict': { | |
508 | 'id': 'vandaag-de-dag-6-mei', | |
509 | 'title': 'Vandaag de Dag 6 mei', | |
510 | }, | |
511 | 'playlist_count': 4, | |
a3d8b381 | 512 | }] |
5742c18b S |
513 | |
514 | ||
515 | class AndereTijdenIE(NPOPlaylistBaseIE): | |
f9dd86a1 | 516 | IE_NAME = 'anderetijden' |
5742c18b S |
517 | _VALID_URL = r'https?://(?:www\.)?anderetijden\.nl/programma/(?:[^/]+/)+(?P<id>[^/?#&]+)' |
518 | _PLAYLIST_TITLE_RE = r'(?s)<h1[^>]+class=["\'].*?\bpage-title\b.*?["\'][^>]*>(.+?)</h1>' | |
519 | _PLAYLIST_ENTRY_RE = r'<figure[^>]+class=["\']episode-container episode-page["\'][^>]+data-prid=["\'](.+?)["\']' | |
520 | ||
521 | _TESTS = [{ | |
522 | 'url': 'http://anderetijden.nl/programma/1/Andere-Tijden/aflevering/676/Duitse-soldaten-over-de-Slag-bij-Arnhem', | |
523 | 'info_dict': { | |
524 | 'id': 'Duitse-soldaten-over-de-Slag-bij-Arnhem', | |
525 | 'title': 'Duitse soldaten over de Slag bij Arnhem', | |
526 | }, | |
527 | 'playlist_count': 3, | |
528 | }] |