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