3 from .common
import InfoExtractor
15 class MDRIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?mdr\.de/(?:.*)/[a-z-]+-?(?P<id>\d+)(?:_.+?)?\.html'
19 _GEO_COUNTRIES
= ['DE']
22 # MDR regularly deletes its videos
23 'url': 'http://www.mdr.de/fakt/video189002.html',
24 'only_matching': True,
27 'url': 'http://www.mdr.de/kultur/audio1312272_zc-15948bad_zs-86171fdd.html',
28 'md5': '64c4ee50f0a791deb9479cd7bbe9d2fa',
32 'title': 'Feuilleton vom 30. Oktober 2015',
34 'uploader': 'MITTELDEUTSCHER RUNDFUNK',
36 'skip': '404 not found',
38 # audio with alternative playerURL pattern
39 'url': 'http://www.mdr.de/kultur/videos-und-audios/audio-radio/operation-mindfuck-robert-wilson100.html',
43 'title': 'Feature: Operation Mindfuck - Robert Anton Wilson',
45 'uploader': 'MITTELDEUTSCHER RUNDFUNK',
47 'skip': '404 not found',
49 'url': 'http://www.mdr.de/mediathek/mdr-videos/a/video-1334.html',
50 'only_matching': True,
53 def _real_extract(self
, url
):
54 video_id
= self
._match
_id
(url
)
56 webpage
= self
._download
_webpage
(url
, video_id
)
58 data_url
= self
._search
_regex
(
59 r
'(?:dataURL|playerXml(?:["\'])?
)\s
*:\s
*(["\'])(?P<url>.+?-avCustom\.xml)\1',
60 webpage, 'data url', group='url').replace(r'\/', '/')
62 doc = self._download_xml(
63 urllib.parse.urljoin(url, data_url), video_id)
65 title = xpath_text(doc, ['./title', './broadcast/broadcastName'], 'title', fatal=True)
67 type_ = xpath_text(doc, './type', default=None)
71 for asset in doc.findall('./assets/asset'):
74 'progressiveDownload',
75 'dynamicHttpStreamingRedirector',
76 'adaptiveHttpStreamingRedirector'):
77 url_el = asset.find(f'./{source}Url')
81 video_url = url_or_none(url_el.text)
82 if not video_url or video_url in processed_urls:
85 processed_urls.append(video_url)
87 ext = determine_ext(video_url)
89 formats.extend(self._extract_m3u8_formats(
90 video_url, video_id, 'mp4', entry_protocol='m3u8_native',
91 quality=1, m3u8_id='HLS', fatal=False))
93 formats.extend(self._extract_f4m_formats(
94 video_url + '?hdcore=3.7.0&plugin=aasp-3.7.0.39.44', video_id,
95 quality=1, f4m_id='HDS', fatal=False))
97 media_type = xpath_text(asset, './mediaType', 'media type', default='MP4')
98 vbr = int_or_none(xpath_text(asset, './bitrateVideo', 'vbr'), 1000)
99 abr = int_or_none(xpath_text(asset, './bitrateAudio', 'abr'), 1000)
100 filesize = int_or_none(xpath_text(asset, './fileSize', 'file size'))
104 'format_id': join_nonempty(media_type, vbr or abr),
105 'filesize': filesize,
112 'width': int_or_none(xpath_text(asset, './frameWidth', 'width')),
113 'height': int_or_none(xpath_text(asset, './frameHeight', 'height')),
121 description = xpath_text(doc, './broadcast/broadcastDescription', 'description')
122 timestamp = parse_iso8601(
125 './broadcast/broadcastDate',
126 './broadcast/broadcastStartDate',
127 './broadcast/broadcastEndDate'],
128 'timestamp', default=None))
129 duration = parse_duration(xpath_text(doc, './duration', 'duration'))
130 uploader = xpath_text(doc, './rights', 'uploader')
135 'description': description,
136 'timestamp': timestamp,
137 'duration': duration,
138 'uploader': uploader,