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.

47 lines
1.5 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import base64
  4. from .common import InfoExtractor
  5. class DumpertIE(InfoExtractor):
  6. _VALID_URL = (r'https?://(?:www\.)?dumpert\.nl/mediabase/'
  7. r'(?P<id>[0-9]+/[0-9a-zA-Z]+)/?.*')
  8. _TEST = {
  9. 'url': 'http://www.dumpert.nl/mediabase/6646981/951bc60f/',
  10. 'md5': '1b9318d7d5054e7dcb9dc7654f21d643',
  11. 'info_dict': {
  12. 'id': '6646981/951bc60f',
  13. 'ext': 'mp4',
  14. 'title': 'Ik heb nieuws voor je',
  15. 'description': 'Niet schrikken hoor'
  16. }
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. title = self._html_search_meta('title', webpage)
  22. description = self._html_search_meta('description', webpage)
  23. files_base64 = self._html_search_regex(r'data-files="(.*?)"',
  24. webpage,
  25. 'files')
  26. files_json = base64.b64decode(files_base64).decode('iso-8859-1')
  27. files = self._parse_json(files_json, video_id)
  28. format_names = ['flv', 'mobile', 'tablet', '720p']
  29. formats = [{'format_id': name,
  30. 'url': files[name].replace(r'\/', '/')}
  31. for name in format_names
  32. if name in files]
  33. return {
  34. 'id': video_id,
  35. 'title': title,
  36. 'description': description,
  37. 'formats': formats
  38. }