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.

40 lines
1.5 KiB

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