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.

67 lines
2.1 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import parse_duration
  5. class RtlXlIE(InfoExtractor):
  6. IE_NAME = 'rtlxl.nl'
  7. _VALID_URL = r'https?://www\.rtlxl\.nl/#!/[^/]+/(?P<uuid>[^/?]+)'
  8. _TEST = {
  9. 'url': 'http://www.rtlxl.nl/#!/rtl-nieuws-132237/6e4203a6-0a5e-3596-8424-c599a59e0677',
  10. 'md5': 'cc16baa36a6c169391f0764fa6b16654',
  11. 'info_dict': {
  12. 'id': '6e4203a6-0a5e-3596-8424-c599a59e0677',
  13. 'ext': 'mp4',
  14. 'title': 'RTL Nieuws - Laat',
  15. 'description': 'md5:6b61f66510c8889923b11f2778c72dc5',
  16. 'timestamp': 1408051800,
  17. 'upload_date': '20140814',
  18. 'duration': 576.880,
  19. },
  20. }
  21. def _real_extract(self, url):
  22. mobj = re.match(self._VALID_URL, url)
  23. uuid = mobj.group('uuid')
  24. info = self._download_json(
  25. 'http://www.rtl.nl/system/s4m/vfd/version=2/uuid=%s/fmt=flash/' % uuid,
  26. uuid)
  27. material = info['material'][0]
  28. episode_info = info['episodes'][0]
  29. progname = info['abstracts'][0]['name']
  30. subtitle = material['title'] or info['episodes'][0]['name']
  31. videopath = material['videopath']
  32. f4m_url = 'http://manifest.us.rtl.nl' + videopath
  33. formats = self._extract_f4m_formats(f4m_url, uuid)
  34. video_urlpart = videopath.split('/flash/')[1][:-4]
  35. PG_URL_TEMPLATE = 'http://pg.us.rtl.nl/rtlxl/network/%s/progressive/%s.mp4'
  36. formats.extend([
  37. {
  38. 'url': PG_URL_TEMPLATE % ('a2m', video_urlpart),
  39. 'format_id': 'pg-sd',
  40. },
  41. {
  42. 'url': PG_URL_TEMPLATE % ('a3m', video_urlpart),
  43. 'format_id': 'pg-hd',
  44. }
  45. ])
  46. return {
  47. 'id': uuid,
  48. 'title': '%s - %s' % (progname, subtitle),
  49. 'formats': formats,
  50. 'timestamp': material['original_date'],
  51. 'description': episode_info['synopsis'],
  52. 'duration': parse_duration(material.get('duration')),
  53. }