In between

This commit is contained in:
Tobias Bell 2022-08-30 13:34:55 +02:00
parent 48f020cb9a
commit 325427ce17

View File

@ -1,5 +1,6 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from __future__ import unicode_literals
import re
from .common import InfoExtractor from .common import InfoExtractor
@ -8,12 +9,14 @@ class W24atIE(InfoExtractor):
_VALID_URL = r'https://(?:www\.)?w24\.at/Video/.*/(?P<id>[0-9]+)' _VALID_URL = r'https://(?:www\.)?w24\.at/Video/.*/(?P<id>[0-9]+)'
_TEST = { _TEST = {
'url': 'https://www.w24.at/Video/Bewegung-macht-Spass-Folge-62-Kids-6/24828', 'url': 'https://www.w24.at/Video/Bewegung-macht-Spass-Folge-62-Kids-6/24828',
'md5': '2cfa88aa93f7747a20567ca1ca4a9ab7', 'md5': 'cc1bd6c334ed284a44528c6dbc9bc6ff',
'info_dict': { 'info_dict': {
'id': '24828', 'id': '24828',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Bewegung macht Spaß! - Folge 62: Kids 6 - W24', 'title': 'Bewegung macht Spaß! - Folge 62: Kids 6',
'description': 'Stefans Ziel ist es Kindern auch hinter den Bildschirmen zur Bewegung und zum Denksport zu animieren und das ganze mit Spaß und Köpfchen zu verbinden.' 'description': 'Stefans Ziel ist es Kindern auch hinter den Bildschirmen zur Bewegung und zum Denksport zu animieren und das ganze mit Spaß und Köpfchen zu verbinden.',
'thumbnail': r're:.*\.jpg$',
'uploader': 'W24'
} }
} }
@ -22,13 +25,20 @@ class W24atIE(InfoExtractor):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
media_server = self._html_search_regex(r'var\s*mediaServer\s*=\s*\{.*"vod"\s*:\s*"([^"]+)"', media_server = self._html_search_regex(r'var\s*mediaServer\s*=\s*\{.*"vod"\s*:\s*"([^"]+)"',
webpage, "vod", "ms02.w24.at") webpage, "vod", "ms02.w24.at")
mp4_path = self._html_search_regex(r"src:.*\+ '([^']+)'.*type:'video/mp4'",
webpage, "mp4_video")
m3u8_path = self._html_search_regex(r"src:.*\+ '([^']+)'.*type:'application/x-mpegURL'", m3u8_path = self._html_search_regex(r"src:.*\+ '([^']+)'.*type:'application/x-mpegURL'",
webpage, "video") webpage, "m3u8")
formats = []
if mp4_path:
formats.append({'url': "https://%s%s" % (media_server, mp4_path)})
formats.extend(self._extract_m3u8_formats("https://%s%s" % (media_server, m3u8_path), video_id, 'mp4', entry_protocol='m3u8_native'))
self._sort_formats(formats)
return { return {
'id': video_id, 'id': video_id,
'title': re.sub(r'\s+-\sW24\s*$', '', self._og_search_title(webpage)), 'title': re.sub(r'\s+-\sW24\s*$', '', self._og_search_title(webpage)),
'description': self._og_search_description(webpage), 'description': self._og_search_description(webpage),
'formats': self._extract_m3u8_formats("https://%s%s" % (media_server, m3u8_path), video_id, 'mp4'), 'formats': formats,
'extension': 'mp4', 'extension': 'mp4',
'thumbnail': self._og_search_thumbnail(webpage), 'thumbnail': self._og_search_thumbnail(webpage),
'uploader': self._og_search_property('site_name', webpage, fatal=False), 'uploader': self._og_search_property('site_name', webpage, fatal=False),