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.

55 lines
1.9 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. 'info_dict': {
  11. 'id': '6e4203a6-0a5e-3596-8424-c599a59e0677',
  12. 'ext': 'flv',
  13. 'title': 'RTL Nieuws - Laat',
  14. 'description': 'Dagelijks het laatste nieuws uit binnen- en '
  15. 'buitenland. Voor nog meer nieuws kunt u ook gebruikmaken van '
  16. 'onze mobiele apps.',
  17. 'timestamp': 1408051800,
  18. 'upload_date': '20140814',
  19. 'duration': 576.880,
  20. },
  21. 'params': {
  22. # We download the first bytes of the first fragment, it can't be
  23. # processed by the f4m downloader beacuse it isn't complete
  24. 'skip_download': True,
  25. },
  26. }
  27. def _real_extract(self, url):
  28. mobj = re.match(self._VALID_URL, url)
  29. uuid = mobj.group('uuid')
  30. info = self._download_json(
  31. 'http://www.rtl.nl/system/s4m/vfd/version=2/uuid=%s/fmt=flash/' % uuid,
  32. uuid)
  33. material = info['material'][0]
  34. episode_info = info['episodes'][0]
  35. f4m_url = 'http://manifest.us.rtl.nl' + material['videopath']
  36. progname = info['abstracts'][0]['name']
  37. subtitle = material['title'] or info['episodes'][0]['name']
  38. return {
  39. 'id': uuid,
  40. 'title': '%s - %s' % (progname, subtitle),
  41. 'formats': self._extract_f4m_formats(f4m_url, uuid),
  42. 'timestamp': material['original_date'],
  43. 'description': episode_info['synopsis'],
  44. 'duration': parse_duration(material.get('duration')),
  45. }