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.

646 lines
23 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/(?:[^/]+/)*|
  34. (?:ntr|npostart)\.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. 'url': 'https://www.npostart.nl/broodje-gezond-ei/28-05-2018/KN_1698996',
  158. 'only_matching': True,
  159. }, {
  160. 'url': 'https://npo.nl/KN_1698996',
  161. 'only_matching': True,
  162. }]
  163. @classmethod
  164. def suitable(cls, url):
  165. return (False if any(ie.suitable(url)
  166. for ie in (NPOLiveIE, NPORadioIE, NPORadioFragmentIE))
  167. else super(NPOIE, cls).suitable(url))
  168. def _real_extract(self, url):
  169. video_id = self._match_id(url)
  170. return self._get_info(video_id)
  171. def _get_info(self, video_id):
  172. metadata = self._download_json(
  173. 'http://e.omroep.nl/metadata/%s' % video_id,
  174. video_id,
  175. # We have to remove the javascript callback
  176. transform_source=strip_jsonp,
  177. )
  178. error = metadata.get('error')
  179. if error:
  180. raise ExtractorError(error, expected=True)
  181. # For some videos actual video id (prid) is different (e.g. for
  182. # http://www.omroepwnl.nl/video/fragment/vandaag-de-dag-verkiezingen__POMS_WNL_853698
  183. # video id is POMS_WNL_853698 but prid is POW_00996502)
  184. video_id = metadata.get('prid') or video_id
  185. # titel is too generic in some cases so utilize aflevering_titel as well
  186. # when available (e.g. http://tegenlicht.vpro.nl/afleveringen/2014-2015/access-to-africa.html)
  187. title = metadata['titel']
  188. sub_title = metadata.get('aflevering_titel')
  189. if sub_title and sub_title != title:
  190. title += ': %s' % sub_title
  191. token = self._get_token(video_id)
  192. formats = []
  193. urls = set()
  194. def is_legal_url(format_url):
  195. return format_url and format_url not in urls and re.match(
  196. r'^(?:https?:)?//', format_url)
  197. QUALITY_LABELS = ('Laag', 'Normaal', 'Hoog')
  198. QUALITY_FORMATS = ('adaptive', 'wmv_sb', 'h264_sb', 'wmv_bb', 'h264_bb', 'wvc1_std', 'h264_std')
  199. quality_from_label = qualities(QUALITY_LABELS)
  200. quality_from_format_id = qualities(QUALITY_FORMATS)
  201. items = self._download_json(
  202. 'http://ida.omroep.nl/app.php/%s' % video_id, video_id,
  203. 'Downloading formats JSON', query={
  204. 'adaptive': 'yes',
  205. 'token': token,
  206. })['items'][0]
  207. for num, item in enumerate(items):
  208. item_url = item.get('url')
  209. if not is_legal_url(item_url):
  210. continue
  211. urls.add(item_url)
  212. format_id = self._search_regex(
  213. r'video/ida/([^/]+)', item_url, 'format id',
  214. default=None)
  215. item_label = item.get('label')
  216. def add_format_url(format_url):
  217. width = int_or_none(self._search_regex(
  218. r'(\d+)[xX]\d+', format_url, 'width', default=None))
  219. height = int_or_none(self._search_regex(
  220. r'\d+[xX](\d+)', format_url, 'height', default=None))
  221. if item_label in QUALITY_LABELS:
  222. quality = quality_from_label(item_label)
  223. f_id = item_label
  224. elif item_label in QUALITY_FORMATS:
  225. quality = quality_from_format_id(format_id)
  226. f_id = format_id
  227. else:
  228. quality, f_id = [None] * 2
  229. formats.append({
  230. 'url': format_url,
  231. 'format_id': f_id,
  232. 'width': width,
  233. 'height': height,
  234. 'quality': quality,
  235. })
  236. # Example: http://www.npo.nl/de-nieuwe-mens-deel-1/21-07-2010/WO_VPRO_043706
  237. if item.get('contentType') in ('url', 'audio'):
  238. add_format_url(item_url)
  239. continue
  240. try:
  241. stream_info = self._download_json(
  242. item_url + '&type=json', video_id,
  243. 'Downloading %s stream JSON'
  244. % item_label or item.get('format') or format_id or num)
  245. except ExtractorError as ee:
  246. if isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 404:
  247. error = (self._parse_json(
  248. ee.cause.read().decode(), video_id,
  249. fatal=False) or {}).get('errorstring')
  250. if error:
  251. raise ExtractorError(error, expected=True)
  252. raise
  253. # Stream URL instead of JSON, example: npo:LI_NL1_4188102
  254. if isinstance(stream_info, compat_str):
  255. if not stream_info.startswith('http'):
  256. continue
  257. video_url = stream_info
  258. # JSON
  259. else:
  260. video_url = stream_info.get('url')
  261. if not video_url or video_url in urls:
  262. continue
  263. urls.add(video_url)
  264. if determine_ext(video_url) == 'm3u8':
  265. formats.extend(self._extract_m3u8_formats(
  266. video_url, video_id, ext='mp4',
  267. entry_protocol='m3u8_native', m3u8_id='hls', fatal=False))
  268. else:
  269. add_format_url(video_url)
  270. is_live = metadata.get('medium') == 'live'
  271. if not is_live:
  272. for num, stream in enumerate(metadata.get('streams', [])):
  273. stream_url = stream.get('url')
  274. if not is_legal_url(stream_url):
  275. continue
  276. urls.add(stream_url)
  277. # smooth streaming is not supported
  278. stream_type = stream.get('type', '').lower()
  279. if stream_type in ['ss', 'ms']:
  280. continue
  281. if stream_type == 'hds':
  282. f4m_formats = self._extract_f4m_formats(
  283. stream_url, video_id, fatal=False)
  284. # f4m downloader downloads only piece of live stream
  285. for f4m_format in f4m_formats:
  286. f4m_format['preference'] = -1
  287. formats.extend(f4m_formats)
  288. elif stream_type == 'hls':
  289. formats.extend(self._extract_m3u8_formats(
  290. stream_url, video_id, ext='mp4', fatal=False))
  291. # Example: http://www.npo.nl/de-nieuwe-mens-deel-1/21-07-2010/WO_VPRO_043706
  292. elif '.asf' in stream_url:
  293. asx = self._download_xml(
  294. stream_url, video_id,
  295. 'Downloading stream %d ASX playlist' % num,
  296. transform_source=fix_xml_ampersands, fatal=False)
  297. if not asx:
  298. continue
  299. ref = asx.find('./ENTRY/Ref')
  300. if ref is None:
  301. continue
  302. video_url = ref.get('href')
  303. if not video_url or video_url in urls:
  304. continue
  305. urls.add(video_url)
  306. formats.append({
  307. 'url': video_url,
  308. 'ext': stream.get('formaat', 'asf'),
  309. 'quality': stream.get('kwaliteit'),
  310. 'preference': -10,
  311. })
  312. else:
  313. formats.append({
  314. 'url': stream_url,
  315. 'quality': stream.get('kwaliteit'),
  316. })
  317. self._sort_formats(formats)
  318. subtitles = {}
  319. if metadata.get('tt888') == 'ja':
  320. subtitles['nl'] = [{
  321. 'ext': 'vtt',
  322. 'url': 'http://tt888.omroep.nl/tt888/%s' % video_id,
  323. }]
  324. return {
  325. 'id': video_id,
  326. 'title': self._live_title(title) if is_live else title,
  327. 'description': metadata.get('info'),
  328. 'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
  329. 'upload_date': unified_strdate(metadata.get('gidsdatum')),
  330. 'duration': parse_duration(metadata.get('tijdsduur')),
  331. 'formats': formats,
  332. 'subtitles': subtitles,
  333. 'is_live': is_live,
  334. }
  335. class NPOLiveIE(NPOBaseIE):
  336. IE_NAME = 'npo.nl:live'
  337. _VALID_URL = r'https?://(?:www\.)?npo\.nl/live(?:/(?P<id>[^/?#&]+))?'
  338. _TESTS = [{
  339. 'url': 'http://www.npo.nl/live/npo-1',
  340. 'info_dict': {
  341. 'id': 'LI_NL1_4188102',
  342. 'display_id': 'npo-1',
  343. 'ext': 'mp4',
  344. 'title': 're:^NPO 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
  345. 'is_live': True,
  346. },
  347. 'params': {
  348. 'skip_download': True,
  349. }
  350. }, {
  351. 'url': 'http://www.npo.nl/live',
  352. 'only_matching': True,
  353. }]
  354. def _real_extract(self, url):
  355. display_id = self._match_id(url) or 'npo-1'
  356. webpage = self._download_webpage(url, display_id)
  357. live_id = self._search_regex(
  358. [r'media-id="([^"]+)"', r'data-prid="([^"]+)"'], webpage, 'live id')
  359. return {
  360. '_type': 'url_transparent',
  361. 'url': 'npo:%s' % live_id,
  362. 'ie_key': NPOIE.ie_key(),
  363. 'id': live_id,
  364. 'display_id': display_id,
  365. }
  366. class NPORadioIE(InfoExtractor):
  367. IE_NAME = 'npo.nl:radio'
  368. _VALID_URL = r'https?://(?:www\.)?npo\.nl/radio/(?P<id>[^/]+)'
  369. _TEST = {
  370. 'url': 'http://www.npo.nl/radio/radio-1',
  371. 'info_dict': {
  372. 'id': 'radio-1',
  373. 'ext': 'mp3',
  374. 'title': 're:^NPO Radio 1 [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
  375. 'is_live': True,
  376. },
  377. 'params': {
  378. 'skip_download': True,
  379. }
  380. }
  381. @classmethod
  382. def suitable(cls, url):
  383. return False if NPORadioFragmentIE.suitable(url) else super(NPORadioIE, cls).suitable(url)
  384. @staticmethod
  385. def _html_get_attribute_regex(attribute):
  386. return r'{0}\s*=\s*\'([^\']+)\''.format(attribute)
  387. def _real_extract(self, url):
  388. video_id = self._match_id(url)
  389. webpage = self._download_webpage(url, video_id)
  390. title = self._html_search_regex(
  391. self._html_get_attribute_regex('data-channel'), webpage, 'title')
  392. stream = self._parse_json(
  393. self._html_search_regex(self._html_get_attribute_regex('data-streams'), webpage, 'data-streams'),
  394. video_id)
  395. codec = stream.get('codec')
  396. return {
  397. 'id': video_id,
  398. 'url': stream['url'],
  399. 'title': self._live_title(title),
  400. 'acodec': codec,
  401. 'ext': codec,
  402. 'is_live': True,
  403. }
  404. class NPORadioFragmentIE(InfoExtractor):
  405. IE_NAME = 'npo.nl:radio:fragment'
  406. _VALID_URL = r'https?://(?:www\.)?npo\.nl/radio/[^/]+/fragment/(?P<id>\d+)'
  407. _TEST = {
  408. 'url': 'http://www.npo.nl/radio/radio-5/fragment/174356',
  409. 'md5': 'dd8cc470dad764d0fdc70a9a1e2d18c2',
  410. 'info_dict': {
  411. 'id': '174356',
  412. 'ext': 'mp3',
  413. 'title': 'Jubileumconcert Willeke Alberti',
  414. },
  415. }
  416. def _real_extract(self, url):
  417. audio_id = self._match_id(url)
  418. webpage = self._download_webpage(url, audio_id)
  419. title = self._html_search_regex(
  420. r'href="/radio/[^/]+/fragment/%s" title="([^"]+)"' % audio_id,
  421. webpage, 'title')
  422. audio_url = self._search_regex(
  423. r"data-streams='([^']+)'", webpage, 'audio url')
  424. return {
  425. 'id': audio_id,
  426. 'url': audio_url,
  427. 'title': title,
  428. }
  429. class NPODataMidEmbedIE(InfoExtractor):
  430. def _real_extract(self, url):
  431. display_id = self._match_id(url)
  432. webpage = self._download_webpage(url, display_id)
  433. video_id = self._search_regex(
  434. r'data-mid=(["\'])(?P<id>(?:(?!\1).)+)\1', webpage, 'video_id', group='id')
  435. return {
  436. '_type': 'url_transparent',
  437. 'ie_key': 'NPO',
  438. 'url': 'npo:%s' % video_id,
  439. 'display_id': display_id
  440. }
  441. class SchoolTVIE(NPODataMidEmbedIE):
  442. IE_NAME = 'schooltv'
  443. _VALID_URL = r'https?://(?:www\.)?schooltv\.nl/video/(?P<id>[^/?#&]+)'
  444. _TEST = {
  445. 'url': 'http://www.schooltv.nl/video/ademhaling-de-hele-dag-haal-je-adem-maar-wat-gebeurt-er-dan-eigenlijk-in-je-lichaam/',
  446. 'info_dict': {
  447. 'id': 'WO_NTR_429477',
  448. 'display_id': 'ademhaling-de-hele-dag-haal-je-adem-maar-wat-gebeurt-er-dan-eigenlijk-in-je-lichaam',
  449. 'title': 'Ademhaling: De hele dag haal je adem. Maar wat gebeurt er dan eigenlijk in je lichaam?',
  450. 'ext': 'mp4',
  451. 'description': 'md5:abfa0ff690adb73fd0297fd033aaa631'
  452. },
  453. 'params': {
  454. # Skip because of m3u8 download
  455. 'skip_download': True
  456. }
  457. }
  458. class HetKlokhuisIE(NPODataMidEmbedIE):
  459. IE_NAME = 'hetklokhuis'
  460. _VALID_URL = r'https?://(?:www\.)?hetklokhuis\.nl/[^/]+/\d+/(?P<id>[^/?#&]+)'
  461. _TEST = {
  462. 'url': 'http://hetklokhuis.nl/tv-uitzending/3471/Zwaartekrachtsgolven',
  463. 'info_dict': {
  464. 'id': 'VPWON_1260528',
  465. 'display_id': 'Zwaartekrachtsgolven',
  466. 'ext': 'm4v',
  467. 'title': 'Het Klokhuis: Zwaartekrachtsgolven',
  468. 'description': 'md5:c94f31fb930d76c2efa4a4a71651dd48',
  469. 'upload_date': '20170223',
  470. },
  471. 'params': {
  472. 'skip_download': True
  473. }
  474. }
  475. class NPOPlaylistBaseIE(NPOIE):
  476. def _real_extract(self, url):
  477. playlist_id = self._match_id(url)
  478. webpage = self._download_webpage(url, playlist_id)
  479. entries = [
  480. self.url_result('npo:%s' % video_id if not video_id.startswith('http') else video_id)
  481. for video_id in orderedSet(re.findall(self._PLAYLIST_ENTRY_RE, webpage))
  482. ]
  483. playlist_title = self._html_search_regex(
  484. self._PLAYLIST_TITLE_RE, webpage, 'playlist title',
  485. default=None) or self._og_search_title(webpage)
  486. return self.playlist_result(entries, playlist_id, playlist_title)
  487. class VPROIE(NPOPlaylistBaseIE):
  488. IE_NAME = 'vpro'
  489. _VALID_URL = r'https?://(?:www\.)?(?:(?:tegenlicht\.)?vpro|2doc)\.nl/(?:[^/]+/)*(?P<id>[^/]+)\.html'
  490. _PLAYLIST_TITLE_RE = (r'<h1[^>]+class=["\'].*?\bmedia-platform-title\b.*?["\'][^>]*>([^<]+)',
  491. r'<h5[^>]+class=["\'].*?\bmedia-platform-subtitle\b.*?["\'][^>]*>([^<]+)')
  492. _PLAYLIST_ENTRY_RE = r'data-media-id="([^"]+)"'
  493. _TESTS = [
  494. {
  495. 'url': 'http://tegenlicht.vpro.nl/afleveringen/2012-2013/de-toekomst-komt-uit-afrika.html',
  496. 'md5': 'f8065e4e5a7824068ed3c7e783178f2c',
  497. 'info_dict': {
  498. 'id': 'VPWON_1169289',
  499. 'ext': 'm4v',
  500. 'title': 'De toekomst komt uit Afrika',
  501. 'description': 'md5:52cf4eefbc96fffcbdc06d024147abea',
  502. 'upload_date': '20130225',
  503. },
  504. 'skip': 'Video gone',
  505. },
  506. {
  507. 'url': 'http://www.vpro.nl/programmas/2doc/2015/sergio-herman.html',
  508. 'info_dict': {
  509. 'id': 'sergio-herman',
  510. 'title': 'sergio herman: fucking perfect',
  511. },
  512. 'playlist_count': 2,
  513. },
  514. {
  515. # playlist with youtube embed
  516. 'url': 'http://www.vpro.nl/programmas/2doc/2015/education-education.html',
  517. 'info_dict': {
  518. 'id': 'education-education',
  519. 'title': 'education education',
  520. },
  521. 'playlist_count': 2,
  522. },
  523. {
  524. 'url': 'http://www.2doc.nl/documentaires/series/2doc/2015/oktober/de-tegenprestatie.html',
  525. 'info_dict': {
  526. 'id': 'de-tegenprestatie',
  527. 'title': 'De Tegenprestatie',
  528. },
  529. 'playlist_count': 2,
  530. }, {
  531. 'url': 'http://www.2doc.nl/speel~VARA_101375237~mh17-het-verdriet-van-nederland~.html',
  532. 'info_dict': {
  533. 'id': 'VARA_101375237',
  534. 'ext': 'm4v',
  535. 'title': 'MH17: Het verdriet van Nederland',
  536. 'description': 'md5:09e1a37c1fdb144621e22479691a9f18',
  537. 'upload_date': '20150716',
  538. },
  539. 'params': {
  540. # Skip because of m3u8 download
  541. 'skip_download': True
  542. },
  543. }
  544. ]
  545. class WNLIE(NPOPlaylistBaseIE):
  546. IE_NAME = 'wnl'
  547. _VALID_URL = r'https?://(?:www\.)?omroepwnl\.nl/video/detail/(?P<id>[^/]+)__\d+'
  548. _PLAYLIST_TITLE_RE = r'(?s)<h1[^>]+class="subject"[^>]*>(.+?)</h1>'
  549. _PLAYLIST_ENTRY_RE = r'<a[^>]+href="([^"]+)"[^>]+class="js-mid"[^>]*>Deel \d+'
  550. _TESTS = [{
  551. 'url': 'http://www.omroepwnl.nl/video/detail/vandaag-de-dag-6-mei__060515',
  552. 'info_dict': {
  553. 'id': 'vandaag-de-dag-6-mei',
  554. 'title': 'Vandaag de Dag 6 mei',
  555. },
  556. 'playlist_count': 4,
  557. }]
  558. class AndereTijdenIE(NPOPlaylistBaseIE):
  559. IE_NAME = 'anderetijden'
  560. _VALID_URL = r'https?://(?:www\.)?anderetijden\.nl/programma/(?:[^/]+/)+(?P<id>[^/?#&]+)'
  561. _PLAYLIST_TITLE_RE = r'(?s)<h1[^>]+class=["\'].*?\bpage-title\b.*?["\'][^>]*>(.+?)</h1>'
  562. _PLAYLIST_ENTRY_RE = r'<figure[^>]+class=["\']episode-container episode-page["\'][^>]+data-prid=["\'](.+?)["\']'
  563. _TESTS = [{
  564. 'url': 'http://anderetijden.nl/programma/1/Andere-Tijden/aflevering/676/Duitse-soldaten-over-de-Slag-bij-Arnhem',
  565. 'info_dict': {
  566. 'id': 'Duitse-soldaten-over-de-Slag-bij-Arnhem',
  567. 'title': 'Duitse soldaten over de Slag bij Arnhem',
  568. },
  569. 'playlist_count': 3,
  570. }]