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.

50 lines
1.7 KiB

10 years ago
10 years ago
  1. # encoding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class DctpTvIE(InfoExtractor):
  5. _VALID_URL = r'^http://www.dctp.tv/(#/)?filme/(?P<id>.+?)/$'
  6. _TEST = {
  7. 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
  8. 'info_dict': {
  9. 'id': '1324',
  10. 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
  11. 'ext': 'flv',
  12. 'title': 'Videoinstallation für eine Kaufhausfassade'}
  13. }
  14. def _real_extract(self, url):
  15. video_id = self._match_id(url)
  16. base_url = 'http://dctp-ivms2-restapi.s3.amazonaws.com/'
  17. version_json = self._download_json(base_url + 'version.json', video_id)
  18. version = version_json['version_name']
  19. info_json = self._download_json(
  20. '{0}{1}/restapi/slugs/{2}.json'.format(base_url, version, video_id), video_id)
  21. object_id = str(info_json['object_id'])
  22. meta_json = self._download_json(
  23. '{0}{1}/restapi/media/{2}.json'.format(base_url, version, object_id), video_id)
  24. uuid = meta_json['uuid']
  25. title = meta_json['title']
  26. wide = meta_json['is_wide']
  27. if wide:
  28. ratio = '16x9'
  29. else:
  30. ratio = '4x3'
  31. play_path = 'mp4:{0}_dctp_0500_{1}.m4v'.format(uuid, ratio)
  32. servers_json = self._download_json('http://www.dctp.tv/streaming_servers/', video_id)
  33. url = servers_json[0]['endpoint']
  34. return {
  35. 'id': object_id,
  36. 'title': title,
  37. 'format': 'rtmp',
  38. 'url': url,
  39. 'play_path': play_path,
  40. 'real_time': True,
  41. 'ext': 'flv',
  42. 'display_id': video_id
  43. }