[ie/wistia] Support password-protected videos (#11100)
[yt-dlp3.git] / yt_dlp / extractor / spiegel.py
blob0397f83fecd31593f481106aa01f40d2391cf277
1 from .common import InfoExtractor
2 from .jwplatform import JWPlatformIE
5 class SpiegelIE(InfoExtractor):
6 _UUID_RE = r'[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}'
7 _VALID_URL = rf'https?://(?:www\.)?(?:spiegel|manager-magazin)\.de(?:/[^/]+)+/[^/]*-(?P<id>[0-9]+|{_UUID_RE})(?:-embed|-iframe)?(?:\.html)?(?:$|[#?])'
8 _TESTS = [{
9 'url': 'http://www.spiegel.de/video/vulkan-tungurahua-in-ecuador-ist-wieder-aktiv-video-1259285.html',
10 'md5': '50c7948883ec85a3e431a0a44b7ad1d6',
11 'info_dict': {
12 'id': 'II0BUyxY',
13 'display_id': '1259285',
14 'ext': 'mp4',
15 'title': 'Vulkan Tungurahua in Ecuador ist wieder aktiv - DER SPIEGEL - Wissenschaft',
16 'description': 'md5:8029d8310232196eb235d27575a8b9f4',
17 'duration': 48.0,
18 'upload_date': '20130311',
19 'timestamp': 1362997920,
21 }, {
22 'url': 'http://www.spiegel.de/video/schach-wm-videoanalyse-des-fuenften-spiels-video-1309159.html',
23 'only_matching': True,
24 }, {
25 'url': 'https://www.spiegel.de/video/eifel-zoo-aufregung-um-ausgebrochene-raubtiere-video-99018031.html',
26 'only_matching': True,
27 }, {
28 'url': 'https://www.spiegel.de/panorama/urteile-im-goldmuenzenprozess-haftstrafen-fuer-clanmitglieder-a-aae8df48-43c1-4c61-867d-23f0a2d254b7',
29 'only_matching': True,
30 }, {
31 'url': 'http://www.spiegel.de/video/spiegel-tv-magazin-ueber-guellekrise-in-schleswig-holstein-video-99012776.html',
32 'only_matching': True,
33 }, {
34 'url': 'http://www.spiegel.de/sport/sonst/badminton-wm-die-randsportart-soll-populaerer-werden-a-987092.html',
35 'only_matching': True,
38 def _real_extract(self, url):
39 video_id = self._match_id(url)
40 webpage = self._download_webpage(url, video_id)
41 media_id = self._html_search_regex(
42 r'(&#34;|["\'])mediaId\1\s*:\s*(&#34;|["\'])(?P<id>(?:(?!\2).)+)\2',
43 webpage, 'media id', group='id')
44 return {
45 '_type': 'url_transparent',
46 'id': video_id,
47 'display_id': video_id,
48 'url': f'jwplatform:{media_id}',
49 'title': self._og_search_title(webpage, default=None),
50 'ie_key': JWPlatformIE.ie_key(),