]>
Commit | Line | Data |
---|---|---|
92bf0bcd S |
1 | from __future__ import unicode_literals |
2 | ||
3 | from .common import InfoExtractor | |
4 | from ..utils import parse_duration | |
5 | ||
6 | ||
7 | class HistoricFilmsIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://(?:www\.)?historicfilms\.com/(?:tapes/|play)(?P<id>\d+)' | |
9 | _TEST = { | |
10 | 'url': 'http://www.historicfilms.com/tapes/4728', | |
11 | 'md5': 'd4a437aec45d8d796a38a215db064e9a', | |
12 | 'info_dict': { | |
13 | 'id': '4728', | |
14 | 'ext': 'mov', | |
15 | 'title': 'Historic Films: GP-7', | |
16 | 'description': 'md5:1a86a0f3ac54024e419aba97210d959a', | |
ec85ded8 | 17 | 'thumbnail': r're:^https?://.*\.jpg$', |
92bf0bcd S |
18 | 'duration': 2096, |
19 | }, | |
20 | } | |
21 | ||
22 | def _real_extract(self, url): | |
23 | video_id = self._match_id(url) | |
24 | ||
25 | webpage = self._download_webpage(url, video_id) | |
26 | ||
27 | tape_id = self._search_regex( | |
ad0c0ad3 S |
28 | [r'class="tapeId"[^>]*>([^<]+)<', r'tapeId\s*:\s*"([^"]+)"'], |
29 | webpage, 'tape id') | |
92bf0bcd S |
30 | |
31 | title = self._og_search_title(webpage) | |
32 | description = self._og_search_description(webpage) | |
33 | thumbnail = self._html_search_meta( | |
34 | 'thumbnailUrl', webpage, 'thumbnails') or self._og_search_thumbnail(webpage) | |
35 | duration = parse_duration(self._html_search_meta( | |
36 | 'duration', webpage, 'duration')) | |
37 | ||
38 | video_url = 'http://www.historicfilms.com/video/%s_%s_web.mov' % (tape_id, video_id) | |
39 | ||
40 | return { | |
41 | 'id': video_id, | |
42 | 'url': video_url, | |
43 | 'title': title, | |
44 | 'description': description, | |
45 | 'thumbnail': thumbnail, | |
46 | 'duration': duration, | |
47 | } |