You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

630 lines
22 KiB

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