[cleanup] Make more playlist entries lazy (#11763)
[yt-dlp.git] / yt_dlp / extractor / dhm.py
bloba5f5f794cb1f6f8db1fb13510b17e96f017a9f55
1 from .common import InfoExtractor
2 from ..utils import parse_duration
5 class DHMIE(InfoExtractor):
6 _WORKING = False
7 IE_DESC = 'Filmarchiv - Deutsches Historisches Museum'
8 _VALID_URL = r'https?://(?:www\.)?dhm\.de/filmarchiv/(?:[^/]+/)+(?P<id>[^/]+)'
10 _TESTS = [{
11 'url': 'http://www.dhm.de/filmarchiv/die-filme/the-marshallplan-at-work-in-west-germany/',
12 'md5': '11c475f670209bf6acca0b2b7ef51827',
13 'info_dict': {
14 'id': 'the-marshallplan-at-work-in-west-germany',
15 'ext': 'flv',
16 'title': 'MARSHALL PLAN AT WORK IN WESTERN GERMANY, THE',
17 'description': 'md5:1fabd480c153f97b07add61c44407c82',
18 'duration': 660,
19 'thumbnail': r're:^https?://.*\.jpg$',
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',
28 'thumbnail': r're:^https?://.*\.jpg$',
32 def _real_extract(self, url):
33 playlist_id = self._match_id(url)
35 webpage = self._download_webpage(url, playlist_id)
37 playlist_url = self._search_regex(
38 r"file\s*:\s*'([^']+)'", webpage, 'playlist url')
40 entries = self._extract_xspf_playlist(playlist_url, playlist_id)
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>',
47 webpage, 'description', default=None)
48 duration = parse_duration(self._search_regex(
49 r'<em>Length\s*</em>\s*:\s*</strong>([^<]+)',
50 webpage, 'duration', default=None))
52 entries[0].update({
53 'title': title,
54 'description': description,
55 'duration': duration,
58 return self.playlist_result(entries, playlist_id)