mirror of
https://github.com/l1ving/youtube-dl
synced 2020-11-18 19:53:54 -08:00
[regiotv] Fix broken extractor (closes #15348)
This commit is contained in:
parent
8c5879715f
commit
a13c91a722
@ -3,59 +3,38 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
|
||||||
from ..utils import (
|
|
||||||
sanitized_Request,
|
|
||||||
xpath_text,
|
|
||||||
xpath_with_ns,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RegioTVIE(InfoExtractor):
|
class RegioTVIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?regio-tv\.de/video/(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://(?:www\.)?regio-tv\.de/.*vidid,(?P<id>[0-9]+)'
|
||||||
_TESTS = [{
|
_TEST = {
|
||||||
'url': 'http://www.regio-tv.de/video/395808.html',
|
'url': 'https://www.regio-tv.de/video_video,-nikolaus-besucht-sindelfinger-markt-_vidid,151732.html',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '395808',
|
'id': '151732',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Wir in Ludwigsburg',
|
'title': 'Nikolaus besucht Sindelfinger Markt',
|
||||||
'description': 'Mit unseren zuckersüßen Adventskindern, außerdem besuchen wir die Abendsterne!',
|
'description': 'md5:205f8c1aa68fcc110c54a4e82b4ce43b',
|
||||||
}
|
}
|
||||||
}, {
|
}
|
||||||
'url': 'http://www.regio-tv.de/video/395808',
|
|
||||||
'only_matching': True,
|
|
||||||
}]
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
key = self._search_regex(
|
key = self._search_regex(
|
||||||
r'key\s*:\s*(["\'])(?P<key>.+?)\1', webpage, 'key', group='key')
|
r'key\s*=\s*(?P<key>[0-9a-f]+)', webpage, 'key', group='key')
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
|
|
||||||
SOAP_TEMPLATE = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><{0} xmlns="http://v.telvi.de/"><key xsi:type="xsd:string">{1}</key></{0}></soap:Body></soap:Envelope>'
|
video_url = 'https://vimp.schwaebische.de/getMedia.php?key=%s&type=mp4' % key
|
||||||
|
|
||||||
request = sanitized_Request(
|
|
||||||
'http://v.telvi.de/',
|
|
||||||
SOAP_TEMPLATE.format('GetHTML5VideoData', key).encode('utf-8'))
|
|
||||||
video_data = self._download_xml(request, video_id, 'Downloading video XML')
|
|
||||||
|
|
||||||
NS_MAP = {
|
|
||||||
'xsi': 'http://www.w3.org/2001/XMLSchema-instance',
|
|
||||||
'soap': 'http://schemas.xmlsoap.org/soap/envelope/',
|
|
||||||
}
|
|
||||||
|
|
||||||
video_url = xpath_text(
|
|
||||||
video_data, xpath_with_ns('.//video', NS_MAP), 'video url', fatal=True)
|
|
||||||
thumbnail = xpath_text(
|
|
||||||
video_data, xpath_with_ns('.//image', NS_MAP), 'thumbnail')
|
|
||||||
description = self._og_search_description(
|
description = self._og_search_description(
|
||||||
webpage) or self._html_search_meta('description', webpage)
|
webpage) or self._html_search_meta('description', webpage)
|
||||||
|
thumbnail = self._og_search_thumbnail(webpage)
|
||||||
|
if thumbnail and thumbnail.startswith('/'):
|
||||||
|
thumbnail = 'https://regio-tv.de' + thumbnail
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
|
'ext': 'mp4',
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user