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