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.

39 lines
1.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class CriterionIE(InfoExtractor):
  5. _VALID_URL = r'https?://(?:www\.)?criterion\.com/films/(?P<id>[0-9]+)-.+'
  6. _TEST = {
  7. 'url': 'http://www.criterion.com/films/184-le-samourai',
  8. 'md5': 'bc51beba55685509883a9a7830919ec3',
  9. 'info_dict': {
  10. 'id': '184',
  11. 'ext': 'mp4',
  12. 'title': 'Le Samouraï',
  13. 'description': 'md5:a2b4b116326558149bef81f76dcbb93f',
  14. 'thumbnail': r're:^https?://.*\.jpg$',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. webpage = self._download_webpage(url, video_id)
  20. final_url = self._search_regex(
  21. r'so\.addVariable\("videoURL", "(.+?)"\)\;', webpage, 'video url')
  22. title = self._og_search_title(webpage)
  23. description = self._html_search_meta('description', webpage)
  24. thumbnail = self._search_regex(
  25. r'so\.addVariable\("thumbnailURL", "(.+?)"\)\;',
  26. webpage, 'thumbnail url')
  27. return {
  28. 'id': video_id,
  29. 'url': final_url,
  30. 'title': title,
  31. 'description': description,
  32. 'thumbnail': thumbnail,
  33. }