logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

historicfilms.py (1581B)


  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import parse_duration
  4. class HistoricFilmsIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?historicfilms\.com/(?:tapes/|play)(?P<id>\d+)'
  6. _TEST = {
  7. 'url': 'http://www.historicfilms.com/tapes/4728',
  8. 'md5': 'd4a437aec45d8d796a38a215db064e9a',
  9. 'info_dict': {
  10. 'id': '4728',
  11. 'ext': 'mov',
  12. 'title': 'Historic Films: GP-7',
  13. 'description': 'md5:1a86a0f3ac54024e419aba97210d959a',
  14. 'thumbnail': r're:^https?://.*\.jpg$',
  15. 'duration': 2096,
  16. },
  17. }
  18. def _real_extract(self, url):
  19. video_id = self._match_id(url)
  20. webpage = self._download_webpage(url, video_id)
  21. tape_id = self._search_regex(
  22. [r'class="tapeId"[^>]*>([^<]+)<', r'tapeId\s*:\s*"([^"]+)"'],
  23. webpage, 'tape id')
  24. title = self._og_search_title(webpage)
  25. description = self._og_search_description(webpage)
  26. thumbnail = self._html_search_meta(
  27. 'thumbnailUrl', webpage, 'thumbnails') or self._og_search_thumbnail(webpage)
  28. duration = parse_duration(self._html_search_meta(
  29. 'duration', webpage, 'duration'))
  30. video_url = 'http://www.historicfilms.com/video/%s_%s_web.mov' % (tape_id, video_id)
  31. return {
  32. 'id': video_id,
  33. 'url': video_url,
  34. 'title': title,
  35. 'description': description,
  36. 'thumbnail': thumbnail,
  37. 'duration': duration,
  38. }