2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from .jwplatform import JWPlatformIE
8 from .nexx import NexxIE
9 from ..compat import compat_urlparse
16 class Tele5IE(InfoExtractor):
17 _VALID_URL = r'https?://(?:www\.)?tele5\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)'
18 _GEO_COUNTRIES = ['DE']
20 'url': 'https://www.tele5.de/mediathek/filme-online/videos?vid=1549416',
24 'upload_date': '20180814',
25 'timestamp': 1534290623,
29 'skip_download': True,
32 # jwplatform, nexx unavailable
33 'url': 'https://www.tele5.de/filme/ghoul-das-geheimnis-des-friedhofmonsters/',
37 'upload_date': '20200603',
38 'timestamp': 1591214400,
39 'title': 'Ghoul - Das Geheimnis des Friedhofmonsters',
40 'description': 'md5:42002af1d887ff3d5b2b3ca1f8137d97',
43 'skip_download': True,
45 'add_ie': [JWPlatformIE.ie_key()],
47 'url': 'https://www.tele5.de/kalkofes-mattscheibe/video-clips/politik-und-gesellschaft?ve_id=1551191',
48 'only_matching': True,
50 'url': 'https://www.tele5.de/video-clip/?ve_id=1609440',
51 'only_matching': True,
53 'url': 'https://www.tele5.de/filme/schlefaz-dragon-crusaders/',
54 'only_matching': True,
56 'url': 'https://www.tele5.de/filme/making-of/avengers-endgame/',
57 'only_matching': True,
59 'url': 'https://www.tele5.de/star-trek/raumschiff-voyager/ganze-folge/das-vinculum/',
60 'only_matching': True,
62 'url': 'https://www.tele5.de/anders-ist-sevda/',
63 'only_matching': True,
66 def _real_extract(self, url):
67 qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
68 video_id = (qs.get('vid') or qs.get('ve_id') or [None])[0]
70 NEXX_ID_RE = r'\d{6,}'
71 JWPLATFORM_ID_RE = r'[a-zA-Z0-9]{8}'
73 def nexx_result(nexx_id):
74 return self.url_result(
75 'https://api.nexx.cloud/v3/759/videos/byid/%s' % nexx_id,
76 ie=NexxIE.ie_key(), video_id=nexx_id)
78 nexx_id = jwplatform_id = None
81 if re.match(NEXX_ID_RE, video_id):
82 return nexx_result(video_id)
83 elif re.match(JWPLATFORM_ID_RE, video_id):
84 jwplatform_id = video_id
87 display_id = self._match_id(url)
88 webpage = self._download_webpage(url, display_id)
90 def extract_id(pattern, name, default=NO_DEFAULT):
91 return self._html_search_regex(
92 (r'id\s*=\s*["\']video-player["\'][^>]+data-id\s*=\s*["\'](%s)' % pattern,
93 r'\s+id\s*=\s*["\']player_(%s)' % pattern,
94 r'\bdata-id\s*=\s*["\'](%s)' % pattern), webpage, name,
97 nexx_id = extract_id(NEXX_ID_RE, 'nexx id', default=None)
99 return nexx_result(nexx_id)
101 if not jwplatform_id:
102 jwplatform_id = extract_id(JWPLATFORM_ID_RE, 'jwplatform id')
104 return self.url_result(
106 'jwplatform:%s' % jwplatform_id,
107 {'geo_countries': self._GEO_COUNTRIES}),
108 ie=JWPlatformIE.ie_key(), video_id=jwplatform_id)