2020-04-09 16:42:08 +02:00
|
|
|
# coding: utf-8
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2020-04-10 10:14:16 +02:00
|
|
|
import re
|
2020-04-09 16:42:08 +02:00
|
|
|
from .common import InfoExtractor
|
|
|
|
|
|
|
|
|
|
|
|
class PlayerGlobeWienIE(InfoExtractor):
|
2020-04-17 15:13:21 +02:00
|
|
|
_VALID_URL = r'https?://player\.(hader\.at|globe\.wien)/[^/]+/(?P<id>[^/?#]+)'
|
2020-04-10 10:14:16 +02:00
|
|
|
_TESTS = [
|
|
|
|
{
|
|
|
|
'url': 'https://player.globe.wien/globe-wien/corona-podcast-teil-4',
|
2020-04-12 12:41:15 +02:00
|
|
|
'md5': 'f973a27e258bdeff686e63434e872f70',
|
2020-04-10 10:14:16 +02:00
|
|
|
'info_dict': {
|
|
|
|
'id': 'corona-podcast-teil-4',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Eckel & Niavarani & Sarsam - Im Endspurt versagt',
|
2020-04-12 12:41:15 +02:00
|
|
|
'description': 'md5:fbd2e2a456fef3a171683dd9e33f1810',
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg',
|
2020-04-10 10:14:16 +02:00
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'bestvideo',
|
2020-04-12 09:16:29 +02:00
|
|
|
'skip_download': True,
|
2020-04-10 10:14:16 +02:00
|
|
|
}
|
2020-04-11 20:30:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
'url': 'https://player.hader.at/hader/hader-indien-video',
|
2020-04-12 13:32:00 +02:00
|
|
|
'md5': '0bca8d5b309361a9556cee6abff2c1b9',
|
2020-04-11 20:30:29 +02:00
|
|
|
'info_dict': {
|
|
|
|
'id': 'hader-indien-video',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Film der Woche - Indien',
|
2020-04-12 13:32:00 +02:00
|
|
|
'description': 'md5:cad9f2bd7a0c5c0dff9cf1cff71288f6',
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg',
|
2020-04-11 20:30:29 +02:00
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'bestvideo',
|
2020-04-12 09:16:29 +02:00
|
|
|
'skip_download': True,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
'url': 'https://player.hader.at/hader/hader-indien',
|
2020-04-12 13:32:00 +02:00
|
|
|
'md5': 'b8bd7cf37d82529411a6e67005739fb3',
|
2020-04-12 09:16:29 +02:00
|
|
|
'info_dict': {
|
|
|
|
'id': 'hader-indien',
|
|
|
|
'ext': 'mp3',
|
|
|
|
'title': 'Hader & Dorfer lesen Indien',
|
2020-04-12 13:32:00 +02:00
|
|
|
'description': 'md5:8b4e1de6c627b7d9ee6cb1c65debfa85',
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg',
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
2020-04-11 20:30:29 +02:00
|
|
|
}
|
|
|
|
},
|
2020-04-10 10:14:16 +02:00
|
|
|
]
|
2020-04-09 16:42:08 +02:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2020-04-17 15:13:21 +02:00
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
next_data = self._parse_json(
|
|
|
|
self._search_regex(
|
|
|
|
r'<script[^>]+id="__NEXT_DATA__"[^>]+type="application/json"[^>]*>([^<]+)</script>',
|
|
|
|
webpage, 'next data'),
|
|
|
|
video_id)
|
2020-04-09 16:42:08 +02:00
|
|
|
|
2020-04-17 15:13:21 +02:00
|
|
|
vod = next_data.get('props').get('initialState').get('vod')
|
2020-04-09 16:42:08 +02:00
|
|
|
|
2020-04-17 15:13:21 +02:00
|
|
|
formats = []
|
|
|
|
for key in vod.get('streamUrl'):
|
|
|
|
src_url = vod.get('streamUrl').get(key)
|
|
|
|
if key == 'hls':
|
|
|
|
formats.extend(self._extract_m3u8_formats(
|
|
|
|
src_url, video_id, ext='mp4', m3u8_id=key, fatal=False))
|
|
|
|
elif key == 'dash':
|
|
|
|
formats.extend(self._extract_mpd_formats(
|
|
|
|
src_url, video_id, mpd_id=key, fatal=False))
|
|
|
|
else:
|
|
|
|
formats.append({
|
|
|
|
'format_id': key,
|
|
|
|
'url': src_url
|
|
|
|
})
|
2020-04-12 09:16:29 +02:00
|
|
|
|
2020-04-17 15:13:21 +02:00
|
|
|
thumbnails = []
|
|
|
|
for key in vod.get('images'):
|
|
|
|
thumbnails.append({
|
|
|
|
'id': key,
|
|
|
|
'url': vod.get('images').get(key),
|
2020-04-12 10:57:36 +02:00
|
|
|
})
|
2020-04-17 15:13:21 +02:00
|
|
|
self._check_formats(formats, video_id)
|
2020-04-09 16:42:08 +02:00
|
|
|
self._sort_formats(formats)
|
2020-04-17 15:13:21 +02:00
|
|
|
|
2020-04-09 16:42:08 +02:00
|
|
|
return {
|
2020-04-17 15:13:21 +02:00
|
|
|
'id': vod.get('id'),
|
|
|
|
'title': vod.get('title'),
|
|
|
|
'description': vod.get('teaserDescription'),
|
|
|
|
'release_year': vod.get('year'),
|
|
|
|
'duration': (vod.get('durationMinutes') or 0) * 60,
|
2020-04-09 16:42:08 +02:00
|
|
|
'formats': formats,
|
2020-04-17 15:13:21 +02:00
|
|
|
'thumbnails': thumbnails,
|
2020-04-09 16:42:08 +02:00
|
|
|
}
|