]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/prosiebensat1.py
670e6950f3fcc67e78ecd466475e7317c8dfd826
2 from __future__
import unicode_literals
6 from hashlib
import sha1
7 from .common
import InfoExtractor
20 class ProSiebenSat1IE(InfoExtractor
):
21 IE_NAME
= 'prosiebensat1'
22 IE_DESC
= 'ProSiebenSat.1 Digital'
23 _VALID_URL
= r
'https?://(?:www\.)?(?:(?:prosieben|prosiebenmaxx|sixx|sat1|kabeleins|the-voice-of-germany|7tv)\.(?:de|at|ch)|ran\.de|fem\.com)/(?P<id>.+)'
27 # Tests changes introduced in https://github.com/rg3/youtube-dl/pull/6242
28 # in response to fixing https://github.com/rg3/youtube-dl/issues/6215:
29 # - malformed f4m manifest support
30 # - proper handling of URLs starting with `https?://` in 2.0 manifests
31 # - recursive child f4m manifests extraction
32 'url': 'http://www.prosieben.de/tv/circus-halligalli/videos/218-staffel-2-episode-18-jahresrueckblick-ganze-folge',
36 'title': 'Episode 18 - Staffel 2',
37 'description': 'md5:8733c81b702ea472e069bc48bb658fc1',
38 'upload_date': '20131231',
43 'skip_download': True,
47 'url': 'http://www.prosieben.de/videokatalog/Gesellschaft/Leben/Trends/video-Lady-Umstyling-f%C3%BCr-Audrina-Rebekka-Audrina-Fergen-billig-aussehen-Battal-Modica-700544.html',
51 'title': 'Lady-Umstyling für Audrina',
52 'description': 'md5:4c16d0c17a3461a0d43ea4084e96319d',
53 'upload_date': '20131014',
58 'skip_download': True,
60 'skip': 'Seems to be broken',
63 'url': 'http://www.prosiebenmaxx.de/tv/experience/video/144-countdown-fuer-die-autowerkstatt-ganze-folge',
67 'title': 'Countdown für die Autowerkstatt',
68 'description': 'md5:809fc051a457b5d8666013bc40698817',
69 'upload_date': '20140223',
74 'skip_download': True,
78 'url': 'http://www.sixx.de/stars-style/video/sexy-laufen-in-ugg-boots-clip',
82 'title': 'Sexy laufen in Ugg Boots',
83 'description': 'md5:edf42b8bd5bc4e5da4db4222c5acb7d6',
84 'upload_date': '20140122',
89 'skip_download': True,
93 'url': 'http://www.sat1.de/film/der-ruecktritt/video/im-interview-kai-wiesinger-clip',
97 'title': 'Im Interview: Kai Wiesinger',
98 'description': 'md5:e4e5370652ec63b95023e914190b4eb9',
99 'upload_date': '20140203',
104 'skip_download': True,
108 'url': 'http://www.kabeleins.de/tv/rosins-restaurants/videos/jagd-auf-fertigkost-im-elsthal-teil-2-ganze-folge',
112 'title': 'Jagd auf Fertigkost im Elsthal - Teil 2',
113 'description': 'md5:2669cde3febe9bce13904f701e774eb6',
114 'upload_date': '20141014',
119 'skip_download': True,
123 'url': 'http://www.ran.de/fussball/bundesliga/video/schalke-toennies-moechte-raul-zurueck-ganze-folge',
127 'title': 'Schalke: Tönnies möchte Raul zurück',
128 'description': 'md5:4b5b271d9bcde223b54390754c8ece3f',
129 'upload_date': '20140226',
134 'skip_download': True,
138 'url': 'http://www.the-voice-of-germany.de/video/31-andreas-kuemmert-rocket-man-clip',
142 'title': 'Andreas Kümmert: Rocket Man',
143 'description': 'md5:6ddb02b0781c6adf778afea606652e38',
144 'upload_date': '20131017',
148 'skip_download': True,
152 'url': 'http://www.fem.com/wellness/videos/wellness-video-clip-kurztripps-zum-valentinstag.html',
156 'title': 'Kurztrips zum Valentinstag',
157 'description': 'Romantischer Kurztrip zum Valentinstag? Nina Heinemann verrät, was sich hier wirklich lohnt.',
161 'skip_download': True,
165 'url': 'http://www.prosieben.de/tv/joko-gegen-klaas/videos/playlists/episode-8-ganze-folge-playlist',
168 'title': 'Episode 8 - Ganze Folge - Playlist',
169 'description': 'md5:63b8963e71f481782aeea877658dec84',
174 'url': 'http://www.7tv.de/circus-halligalli/615-best-of-circus-halligalli-ganze-folge',
178 'title': 'Best of Circus HalliGalli',
179 'description': 'md5:8849752efd90b9772c9db6fdf87fb9e9',
180 'upload_date': '20151229',
183 'skip_download': True,
189 r
'"clip_id"\s*:\s+"(\d+)"',
192 r
'clip[iI]d\s*=\s*["\'](\d
+)',
193 r"'itemImageUrl
'\s*:\s*'/dynamic
/thumbnails
/full
/\d
+/(\d
+)",
196 r'<h2 class="subtitle
" itemprop="name
">\s*(.+?)</h2>',
197 r'<header class="clearfix
">\s*<h3>(.+?)</h3>',
198 r'<!-- start video -->\s*<h1>(.+?)</h1>',
199 r'<h1 class="att
-name
">\s*(.+?)</h1>',
200 r'<header class="module_header
">\s*<h2>([^<]+)</h2>\s*</header>',
201 r'<h2 class="video
-title
" itemprop="name
">\s*(.+?)</h2>',
202 r'<div[^>]+id="veeseoTitle
"[^>]*>(.+?)</div>',
204 _DESCRIPTION_REGEXES = [
205 r'<p itemprop="description
">\s*(.+?)</p>',
206 r'<div class="videoDecription
">\s*<p><strong>Beschreibung</strong>: (.+?)</p>',
207 r'<div class="g
-plusone
" data-size="medium
"></div>\s*</div>\s*</header>\s*(.+?)\s*<footer>',
208 r'<p class="att
-description
">\s*(.+?)\s*</p>',
209 r'<p class="video
-description
" itemprop="description
">\s*(.+?)</p>',
210 r'<div[^>]+id="veeseoDescription
"[^>]*>(.+?)</div>',
212 _UPLOAD_DATE_REGEXES = [
213 r'<meta property="og
:published_time
" content="(.+?
)">',
214 r'<span>\s*(\d{2}\.\d{2}\.\d{4} \d{2}:\d{2}) \|\s*<span itemprop="duration
"',
215 r'<footer>\s*(\d{2}\.\d{2}\.\d{4}) \d{2}:\d{2} Uhr',
216 r'<span style="padding
-left
: 4px
;line
-height
:20px
; color
:#404040">(\d{2}\.\d{2}\.\d{4})</span>',
217 r
'(\d{2}\.\d{2}\.\d{4}) \| \d{2}:\d{2} Min<br/>',
219 _PAGE_TYPE_REGEXES
= [
220 r
'<meta name="page_type" content="([^"]+)">',
221 r
"'itemType'\s*:\s*'([^']*)'",
223 _PLAYLIST_ID_REGEXES
= [
224 r
'content[iI]d=(\d+)',
225 r
"'itemId'\s*:\s*'([^']*)'",
227 _PLAYLIST_CLIP_REGEXES
= [
228 r
'(?s)data-qvt=.+?<a href="([^"]+)"',
231 def _extract_clip(self
, url
, webpage
):
232 clip_id
= self
._html
_search
_regex
(self
._CLIPID
_REGEXES
, webpage
, 'clip id')
234 access_token
= 'prosieben'
235 client_name
= 'kolibri-2.0.19-splec4'
236 client_location
= url
238 videos_api_url
= 'http://vas.sim-technik.de/vas/live/v2/videos?%s' % compat_urllib_parse
.urlencode({
239 'access_token': access_token
,
240 'client_location': client_location
,
241 'client_name': client_name
,
245 video
= self
._download
_json
(videos_api_url
, clip_id
, 'Downloading videos JSON')[0]
247 if video
.get('is_protected') is True:
248 raise ExtractorError('This video is DRM protected.', expected
=True)
250 duration
= float_or_none(video
.get('duration'))
251 source_ids
= [source
['id'] for source
in video
['sources']]
252 source_ids_str
= ','.join(map(str, source_ids
))
254 g
= '01!8d8F_)r9]4s[qeuXfP%'
256 client_id
= g
[:2] + sha1(''.join([clip_id
, g
, access_token
, client_location
, g
, client_name
])
257 .encode('utf-8')).hexdigest()
259 sources_api_url
= 'http://vas.sim-technik.de/vas/live/v2/videos/%s/sources?%s' % (clip_id
, compat_urllib_parse
.urlencode({
260 'access_token': access_token
,
261 'client_id': client_id
,
262 'client_location': client_location
,
263 'client_name': client_name
,
266 sources
= self
._download
_json
(sources_api_url
, clip_id
, 'Downloading sources JSON')
267 server_id
= sources
['server_id']
269 client_id
= g
[:2] + sha1(''.join([g
, clip_id
, access_token
, server_id
,
270 client_location
, source_ids_str
, g
, client_name
])
271 .encode('utf-8')).hexdigest()
273 url_api_url
= 'http://vas.sim-technik.de/vas/live/v2/videos/%s/sources/url?%s' % (clip_id
, compat_urllib_parse
.urlencode({
274 'access_token': access_token
,
275 'client_id': client_id
,
276 'client_location': client_location
,
277 'client_name': client_name
,
278 'server_id': server_id
,
279 'source_ids': source_ids_str
,
282 urls
= self
._download
_json
(url_api_url
, clip_id
, 'Downloading urls JSON')
284 title
= self
._html
_search
_regex
(self
._TITLE
_REGEXES
, webpage
, 'title')
285 description
= self
._html
_search
_regex
(self
._DESCRIPTION
_REGEXES
, webpage
, 'description', fatal
=False)
286 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
288 upload_date
= unified_strdate(self
._html
_search
_regex
(
289 self
._UPLOAD
_DATE
_REGEXES
, webpage
, 'upload date', default
=None))
293 urls_sources
= urls
['sources']
294 if isinstance(urls_sources
, dict):
295 urls_sources
= urls_sources
.values()
297 def fix_bitrate(bitrate
):
298 bitrate
= int_or_none(bitrate
)
301 return (bitrate
// 1000) if bitrate
% 1000 == 0 else bitrate
303 for source
in urls_sources
:
304 protocol
= source
['protocol']
305 source_url
= source
['url']
306 if protocol
== 'rtmp' or protocol
== 'rtmpe':
307 mobj
= re
.search(r
'^(?P<url>rtmpe?://[^/]+)/(?P<path>.+)$', source_url
)
310 path
= mobj
.group('path')
311 mp4colon_index
= path
.rfind('mp4:')
312 app
= path
[:mp4colon_index
]
313 play_path
= path
[mp4colon_index
:]
315 'url': '%s/%s' % (mobj
.group('url'), app
),
317 'play_path': play_path
,
318 'player_url': 'http://livepassdl.conviva.com/hf/ver/2.79.0.17083/LivePassModuleMain.swf',
319 'page_url': 'http://www.prosieben.de',
320 'vbr': fix_bitrate(source
['bitrate']),
322 'format_id': '%s_%s' % (source
['cdn'], source
['bitrate']),
324 elif 'f4mgenerator' in source_url
or determine_ext(source_url
) == 'f4m':
325 formats
.extend(self
._extract
_f
4m
_formats
(source_url
, clip_id
))
329 'vbr': fix_bitrate(source
['bitrate']),
332 self
._sort
_formats
(formats
)
337 'description': description
,
338 'thumbnail': thumbnail
,
339 'upload_date': upload_date
,
340 'duration': duration
,
344 def _extract_playlist(self
, url
, webpage
):
345 playlist_id
= self
._html
_search
_regex
(
346 self
._PLAYLIST
_ID
_REGEXES
, webpage
, 'playlist id')
347 for regex
in self
._PLAYLIST
_CLIP
_REGEXES
:
348 playlist_clips
= re
.findall(regex
, webpage
)
350 title
= self
._html
_search
_regex
(
351 self
._TITLE
_REGEXES
, webpage
, 'title')
352 description
= self
._html
_search
_regex
(
353 self
._DESCRIPTION
_REGEXES
, webpage
, 'description', fatal
=False)
356 re
.match('(.+?//.+?)/', url
).group(1) + clip_path
,
358 for clip_path
in playlist_clips
]
359 return self
.playlist_result(entries
, playlist_id
, title
, description
)
361 def _real_extract(self
, url
):
362 video_id
= self
._match
_id
(url
)
363 webpage
= self
._download
_webpage
(url
, video_id
)
364 page_type
= self
._search
_regex
(
365 self
._PAGE
_TYPE
_REGEXES
, webpage
,
366 'page type', default
='clip').lower()
367 if page_type
== 'clip':
368 return self
._extract
_clip
(url
, webpage
)
369 elif page_type
== 'playlist':
370 return self
._extract
_playlist
(url
, webpage
)