[srmediathek] improve extraction
This commit is contained in:
parent
6418b2439b
commit
1fc0b47fdf
|
@ -110,13 +110,19 @@ class ARDMediathekIE(InfoExtractor):
|
||||||
server = stream.get('_server')
|
server = stream.get('_server')
|
||||||
for stream_url in stream_urls:
|
for stream_url in stream_urls:
|
||||||
ext = determine_ext(stream_url)
|
ext = determine_ext(stream_url)
|
||||||
|
if quality != 'auto' and ext in ('f4m', 'm3u8'):
|
||||||
|
continue
|
||||||
if ext == 'f4m':
|
if ext == 'f4m':
|
||||||
formats.extend(self._extract_f4m_formats(
|
f4m_formats = self._extract_f4m_formats(
|
||||||
stream_url + '?hdcore=3.1.1&plugin=aasp-3.1.1.69.124',
|
stream_url + '?hdcore=3.1.1&plugin=aasp-3.1.1.69.124',
|
||||||
video_id, preference=-1, f4m_id='hds'))
|
video_id, preference=-1, f4m_id='hds', fatal=False)
|
||||||
|
if f4m_formats:
|
||||||
|
formats.extend(f4m_formats)
|
||||||
elif ext == 'm3u8':
|
elif ext == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(
|
m3u8_formats = self._extract_m3u8_formats(
|
||||||
stream_url, video_id, 'mp4', preference=1, m3u8_id='hls'))
|
stream_url, video_id, 'mp4', preference=1, m3u8_id='hls', fatal=False)
|
||||||
|
if m3u8_formats:
|
||||||
|
formats.extend(m3u8_formats)
|
||||||
else:
|
else:
|
||||||
if server and server.startswith('rtmp'):
|
if server and server.startswith('rtmp'):
|
||||||
f = {
|
f = {
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
from .ard import ARDMediathekIE
|
||||||
|
from ..utils import (
|
||||||
from .common import InfoExtractor
|
ExtractorError,
|
||||||
from ..utils import js_to_json
|
get_element_by_attribute,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SRMediathekIE(InfoExtractor):
|
class SRMediathekIE(ARDMediathekIE):
|
||||||
IE_DESC = 'Saarländischer Rundfunk'
|
IE_DESC = 'Saarländischer Rundfunk'
|
||||||
_VALID_URL = r'https?://sr-mediathek\.sr-online\.de/index\.php\?.*?&id=(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://sr-mediathek\.sr-online\.de/index\.php\?.*?&id=(?P<id>[0-9]+)'
|
||||||
|
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455',
|
'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=28455',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '28455',
|
'id': '28455',
|
||||||
|
@ -20,24 +21,36 @@ class SRMediathekIE(InfoExtractor):
|
||||||
'description': 'Ringen: KSV Köllerbach gegen Aachen-Walheim; Frauen-Fußball: 1. FC Saarbrücken gegen Sindelfingen; Motorsport: Rallye in Losheim; dazu: Interview mit Timo Bernhard; Turnen: TG Saar; Reitsport: Deutscher Voltigier-Pokal; Badminton: Interview mit Michael Fuchs ',
|
'description': 'Ringen: KSV Köllerbach gegen Aachen-Walheim; Frauen-Fußball: 1. FC Saarbrücken gegen Sindelfingen; Motorsport: Rallye in Losheim; dazu: Interview mit Timo Bernhard; Turnen: TG Saar; Reitsport: Deutscher Voltigier-Pokal; Badminton: Interview mit Michael Fuchs ',
|
||||||
'thumbnail': 're:^https?://.*\.jpg$',
|
'thumbnail': 're:^https?://.*\.jpg$',
|
||||||
},
|
},
|
||||||
}
|
'skip': 'no longer available',
|
||||||
|
}, {
|
||||||
|
'url': 'http://sr-mediathek.sr-online.de/index.php?seite=7&id=37682',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '37682',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Love, Cakes and Rock\'n\'Roll',
|
||||||
|
'description': 'md5:18bf9763631c7d326c22603681e1123d',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
# m3u8 download
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
'expected_warnings': ['Unable to download f4m manifest']
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
murls = json.loads(js_to_json(self._search_regex(
|
if '>Der gewünschte Beitrag ist leider nicht mehr verfügbar.<' in webpage:
|
||||||
r'var mediaURLs\s*=\s*(.*?);\n', webpage, 'video URLs')))
|
raise ExtractorError('Video %s is no longer available' % video_id, expected=True)
|
||||||
formats = [{'url': murl} for murl in murls]
|
|
||||||
self._sort_formats(formats)
|
|
||||||
|
|
||||||
title = json.loads(js_to_json(self._search_regex(
|
media_collection_url = self._search_regex(
|
||||||
r'var mediaTitles\s*=\s*(.*?);\n', webpage, 'title')))[0]
|
r'data-mediacollection-ardplayer="([^"]+)"', webpage, 'media collection url')
|
||||||
|
info = self._extract_media_info(media_collection_url, webpage, video_id)
|
||||||
return {
|
info.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': get_element_by_attribute('class', 'ardplayer-title', webpage),
|
||||||
'formats': formats,
|
|
||||||
'description': self._og_search_description(webpage),
|
'description': self._og_search_description(webpage),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
}
|
})
|
||||||
|
return info
|
||||||
|
|
Loading…
Reference in New Issue