npo.py 22 KB

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