]>
Commit | Line | Data |
---|---|---|
c43fda4c | 1 | from .common import InfoExtractor |
2 | ||
3 | from ..utils import ( | |
4 | sanitized_Request, | |
34a9da13 | 5 | xpath_text, |
c43fda4c | 6 | xpath_with_ns, |
7 | ) | |
8 | ||
9 | ||
10 | class RegioTVIE(InfoExtractor): | |
34a9da13 S |
11 | _VALID_URL = r'https?://(?:www\.)?regio-tv\.de/video/(?P<id>[0-9]+)' |
12 | _TESTS = [{ | |
13 | 'url': 'http://www.regio-tv.de/video/395808.html', | |
14 | 'info_dict': { | |
15 | 'id': '395808', | |
16 | 'ext': 'mp4', | |
17 | 'title': 'Wir in Ludwigsburg', | |
18 | 'description': 'Mit unseren zuckersüßen Adventskindern, außerdem besuchen wir die Abendsterne!', | |
19 | } | |
20 | }, { | |
21 | 'url': 'http://www.regio-tv.de/video/395808', | |
22 | 'only_matching': True, | |
23 | }] | |
c43fda4c | 24 | |
25 | def _real_extract(self, url): | |
34a9da13 | 26 | video_id = self._match_id(url) |
c43fda4c | 27 | |
28 | webpage = self._download_webpage(url, video_id) | |
c43fda4c | 29 | |
34a9da13 S |
30 | key = self._search_regex( |
31 | r'key\s*:\s*(["\'])(?P<key>.+?)\1', webpage, 'key', group='key') | |
32 | title = self._og_search_title(webpage) | |
33 | ||
34 | 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>' | |
c43fda4c | 35 | |
34a9da13 S |
36 | request = sanitized_Request( |
37 | 'http://v.telvi.de/', | |
38 | SOAP_TEMPLATE.format('GetHTML5VideoData', key).encode('utf-8')) | |
39 | video_data = self._download_xml(request, video_id, 'Downloading video XML') | |
c43fda4c | 40 | |
41 | NS_MAP = { | |
42 | 'xsi': 'http://www.w3.org/2001/XMLSchema-instance', | |
43 | 'soap': 'http://schemas.xmlsoap.org/soap/envelope/', | |
44 | } | |
45 | ||
34a9da13 S |
46 | video_url = xpath_text( |
47 | video_data, xpath_with_ns('.//video', NS_MAP), 'video url', fatal=True) | |
48 | thumbnail = xpath_text( | |
49 | video_data, xpath_with_ns('.//image', NS_MAP), 'thumbnail') | |
50 | description = self._og_search_description( | |
51 | webpage) or self._html_search_meta('description', webpage) | |
c43fda4c | 52 | |
53 | return { | |
54 | 'id': video_id, | |
34a9da13 | 55 | 'url': video_url, |
c43fda4c | 56 | 'title': title, |
c43fda4c | 57 | 'description': description, |
34a9da13 | 58 | 'thumbnail': thumbnail, |
c43fda4c | 59 | } |