mirror of
https://github.com/l1ving/youtube-dl
synced 2020-11-18 19:53:54 -08:00
[servus] Fix extraction
This commit is contained in:
parent
00eb865b3c
commit
2114da14f0
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import ExtractorError, JSON_LD_RE
|
||||||
|
|
||||||
|
|
||||||
class ServusIE(InfoExtractor):
|
class ServusIE(InfoExtractor):
|
||||||
@ -19,13 +20,14 @@ class ServusIE(InfoExtractor):
|
|||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# new URL schema
|
# new URL schema
|
||||||
'url': 'https://www.servustv.com/videos/aa-1t6vbu5pw1w12/',
|
'url': 'https://www.servustv.com/videos/aa-1t6vbu5pw1w12/',
|
||||||
'md5': '3e1dd16775aa8d5cbef23628cfffc1f4',
|
'md5': '9f825d6ec14b3d8bebc5b23d094e1e51',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'AA-1T6VBU5PW1W12',
|
'id': 'AA-1T6VBU5PW1W12',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Die Grünen aus Sicht des Volkes',
|
'title': 'Die Grünen aus Sicht des Volkes',
|
||||||
'description': 'md5:1247204d85783afe3682644398ff2ec4',
|
'description': 'md5:1247204d85783afe3682644398ff2ec4',
|
||||||
'thumbnail': r're:^https?://.*\.jpg',
|
'upload_date': '20170911',
|
||||||
|
'timestamp': 1505147648,
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
# old URL schema
|
# old URL schema
|
||||||
@ -46,24 +48,20 @@ class ServusIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url).upper()
|
video_id = self._match_id(url).upper()
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
title = self._search_regex(
|
if 'rbmh-video-player-trigger' not in webpage:
|
||||||
(r'videoLabel\s*=\s*(["\'])(?P<title>(?:(?!\1).)+)\1',
|
raise ExtractorError('Video not available (maybe not aired yet)', expected=True, video_id=video_id)
|
||||||
r'<h\d+[^>]+\bclass=["\']heading--(?:one|two)["\'][^>]*>(?P<title>[^<]+)'),
|
|
||||||
webpage, 'title', default=None,
|
|
||||||
group='title') or self._og_search_title(webpage)
|
|
||||||
title = re.sub(r'\s*-\s*Servus TV\s*$', '', title)
|
|
||||||
description = self._og_search_description(webpage)
|
|
||||||
thumbnail = self._og_search_thumbnail(webpage)
|
|
||||||
|
|
||||||
formats = self._extract_m3u8_formats(
|
info = {}
|
||||||
'https://stv.rbmbtnx.net/api/v1/manifests/%s.m3u8' % video_id,
|
for match in re.finditer(JSON_LD_RE, webpage):
|
||||||
video_id, 'mp4', entry_protocol='m3u8_native', m3u8_id='hls')
|
json_ld = match.group('json_ld')
|
||||||
self._sort_formats(formats)
|
info = self._json_ld(json_ld, video_id)
|
||||||
|
if info:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise ExtractorError('Could not extract video URL', video_id=video_id)
|
||||||
|
|
||||||
return {
|
info['id'] = video_id
|
||||||
'id': video_id,
|
info['formats'] = self._extract_m3u8_formats(info['url'], video_id, 'mp4')
|
||||||
'title': title,
|
self._sort_formats(info['formats'])
|
||||||
'description': description,
|
|
||||||
'thumbnail': thumbnail,
|
return info
|
||||||
'formats': formats,
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user