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