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.

43 lines
1.3 KiB

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