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.

41 lines
1.2 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_meta('description', webpage)
  25. thumbnail = self._search_regex(
  26. r'so.addVariable\("thumbnailURL", "(.+?)"\)\;',
  27. webpage, 'thumbnail url')
  28. return {
  29. 'id': video_id,
  30. 'url': final_url,
  31. 'title': title,
  32. 'description': description,
  33. 'thumbnail': thumbnail,
  34. }