]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tele5.py
364556a1f89d3c1943950c1634bbfae0639a3e7d
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from .jwplatform
import JWPlatformIE
8 from .nexx
import NexxIE
19 class Tele5IE(InfoExtractor
):
20 _VALID_URL
= r
'https?://(?:www\.)?tele5\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)'
22 'url': 'https://www.tele5.de/mediathek/filme-online/videos?vid=1549416',
26 'upload_date': '20180814',
27 'timestamp': 1534290623,
31 'skip_download': True,
34 'url': 'https://www.tele5.de/kalkofes-mattscheibe/video-clips/politik-und-gesellschaft?ve_id=1551191',
35 'only_matching': True,
37 'url': 'https://www.tele5.de/video-clip/?ve_id=1609440',
38 'only_matching': True,
40 'url': 'https://www.tele5.de/filme/schlefaz-dragon-crusaders/',
41 'only_matching': True,
43 'url': 'https://www.tele5.de/filme/making-of/avengers-endgame/',
44 'only_matching': True,
46 'url': 'https://www.tele5.de/star-trek/raumschiff-voyager/ganze-folge/das-vinculum/',
47 'only_matching': True,
49 'url': 'https://www.tele5.de/anders-ist-sevda/',
50 'only_matching': True,
53 def _real_extract(self
, url
):
54 qs
= compat_urlparse
.parse_qs(compat_urlparse
.urlparse(url
).query
)
55 video_id
= (qs
.get('vid') or qs
.get('ve_id') or [None])[0]
57 NEXX_ID_RE
= r
'\d{6,}'
58 JWPLATFORM_ID_RE
= r
'[a-zA-Z0-9]{8}'
60 def nexx_result(nexx_id
):
61 return self
.url_result(
62 'https://api.nexx.cloud/v3/759/videos/byid/%s' % nexx_id
,
63 ie
=NexxIE
.ie_key(), video_id
=nexx_id
)
65 nexx_id
= jwplatform_id
= None
68 if re
.match(NEXX_ID_RE
, video_id
):
69 return nexx_result(video_id
)
70 elif re
.match(JWPLATFORM_ID_RE
, video_id
):
71 jwplatform_id
= video_id
74 display_id
= self
._match
_id
(url
)
75 webpage
= self
._download
_webpage
(url
, display_id
)
77 def extract_id(pattern
, name
, default
=NO_DEFAULT
):
78 return self
._html
_search
_regex
(
79 (r
'id\s*=\s*["\']video
-player
["\'][^>]+data-id\s*=\s*["\'](%s)' % pattern,
80 r'\s
+id\s
*=\s
*["\']player_(%s)' % pattern,
81 r'\bdata-id\s*=\s*["\'](%s)' % pattern), webpage, name,
84 nexx_id = extract_id(NEXX_ID_RE, 'nexx
id', default=None)
86 return nexx_result(nexx_id)
89 jwplatform_id = extract_id(JWPLATFORM_ID_RE, 'jwplatform
id')
91 media = self._download_json(
92 'https
://cdn
.jwplayer
.com
/v2
/media
/' + jwplatform_id,
95 media, lambda x: x['playlist
'][0]['nexx_id
'], compat_str)
98 return nexx_result(nexx_id)
100 return self.url_result(
101 'jwplatform
:%s' % jwplatform_id, ie=JWPlatformIE.ie_key(),
102 video_id=jwplatform_id)