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.

54 lines
2.0 KiB

10 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import unified_strdate
  5. class DctpTvIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?dctp\.tv/(#/)?filme/(?P<id>.+?)/$'
  7. _TEST = {
  8. 'url': 'http://www.dctp.tv/filme/videoinstallation-fuer-eine-kaufhausfassade/',
  9. 'md5': '174dd4a8a6225cf5655952f969cfbe24',
  10. 'info_dict': {
  11. 'id': '95eaa4f33dad413aa17b4ee613cccc6c',
  12. 'display_id': 'videoinstallation-fuer-eine-kaufhausfassade',
  13. 'ext': 'mp4',
  14. 'title': 'Videoinstallation für eine Kaufhausfassade',
  15. 'description': 'Kurzfilm',
  16. 'upload_date': '20110407',
  17. 'thumbnail': r're:^https?://.*\.jpg$',
  18. },
  19. }
  20. def _real_extract(self, url):
  21. video_id = self._match_id(url)
  22. webpage = self._download_webpage(url, video_id)
  23. object_id = self._html_search_meta('DC.identifier', webpage)
  24. servers_json = self._download_json(
  25. 'http://www.dctp.tv/elastic_streaming_client/get_streaming_server/',
  26. video_id, note='Downloading server list')
  27. server = servers_json[0]['server']
  28. m3u8_path = self._search_regex(
  29. r'\'([^\'"]+/playlist\.m3u8)"', webpage, 'm3u8 path')
  30. formats = self._extract_m3u8_formats(
  31. 'http://%s%s' % (server, m3u8_path), video_id, ext='mp4',
  32. entry_protocol='m3u8_native')
  33. title = self._og_search_title(webpage)
  34. description = self._html_search_meta('DC.description', webpage)
  35. upload_date = unified_strdate(
  36. self._html_search_meta('DC.date.created', webpage))
  37. thumbnail = self._og_search_thumbnail(webpage)
  38. return {
  39. 'id': object_id,
  40. 'title': title,
  41. 'formats': formats,
  42. 'display_id': video_id,
  43. 'description': description,
  44. 'upload_date': upload_date,
  45. 'thumbnail': thumbnail,
  46. }