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