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