]>
Commit | Line | Data |
---|---|---|
643fe727 | 1 | from .common import InfoExtractor |
237c03c8 | 2 | from ..utils import parse_duration |
643fe727 OJ |
3 | |
4 | ||
5 | class DHMIE(InfoExtractor): | |
af8c9308 | 6 | IE_DESC = 'Filmarchiv - Deutsches Historisches Museum' |
5a3b315b | 7 | _VALID_URL = r'https?://(?:www\.)?dhm\.de/filmarchiv/(?:[^/]+/)+(?P<id>[^/]+)' |
643fe727 | 8 | |
5a3b315b | 9 | _TESTS = [{ |
643fe727 OJ |
10 | 'url': 'http://www.dhm.de/filmarchiv/die-filme/the-marshallplan-at-work-in-west-germany/', |
11 | 'md5': '11c475f670209bf6acca0b2b7ef51827', | |
12 | 'info_dict': { | |
af8c9308 | 13 | 'id': 'the-marshallplan-at-work-in-west-germany', |
643fe727 OJ |
14 | 'ext': 'flv', |
15 | 'title': 'MARSHALL PLAN AT WORK IN WESTERN GERMANY, THE', | |
af8c9308 S |
16 | 'description': 'md5:1fabd480c153f97b07add61c44407c82', |
17 | 'duration': 660, | |
ec85ded8 | 18 | 'thumbnail': r're:^https?://.*\.jpg$', |
5a3b315b S |
19 | }, |
20 | }, { | |
21 | 'url': 'http://www.dhm.de/filmarchiv/02-mapping-the-wall/peter-g/rolle-1/', | |
22 | 'md5': '09890226332476a3e3f6f2cb74734aa5', | |
23 | 'info_dict': { | |
24 | 'id': 'rolle-1', | |
25 | 'ext': 'flv', | |
26 | 'title': 'ROLLE 1', | |
ec85ded8 | 27 | 'thumbnail': r're:^https?://.*\.jpg$', |
5a3b315b S |
28 | }, |
29 | }] | |
643fe727 OJ |
30 | |
31 | def _real_extract(self, url): | |
fb2f339f | 32 | playlist_id = self._match_id(url) |
af8c9308 | 33 | |
fb2f339f | 34 | webpage = self._download_webpage(url, playlist_id) |
643fe727 | 35 | |
af8c9308 S |
36 | playlist_url = self._search_regex( |
37 | r"file\s*:\s*'([^']+)'", webpage, 'playlist url') | |
643fe727 | 38 | |
fb2f339f | 39 | entries = self._extract_xspf_playlist(playlist_url, playlist_id) |
643fe727 | 40 | |
af8c9308 S |
41 | title = self._search_regex( |
42 | [r'dc:title="([^"]+)"', r'<title> »([^<]+)</title>'], | |
43 | webpage, 'title').strip() | |
44 | description = self._html_search_regex( | |
45 | r'<p><strong>Description:</strong>(.+?)</p>', | |
5a3b315b | 46 | webpage, 'description', default=None) |
af8c9308 S |
47 | duration = parse_duration(self._search_regex( |
48 | r'<em>Length\s*</em>\s*:\s*</strong>([^<]+)', | |
5a3b315b | 49 | webpage, 'duration', default=None)) |
643fe727 | 50 | |
fb2f339f | 51 | entries[0].update({ |
af8c9308 S |
52 | 'title': title, |
53 | 'description': description, | |
54 | 'duration': duration, | |
fb2f339f S |
55 | }) |
56 | ||
57 | return self.playlist_result(entries, playlist_id) |