| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  | # coding: utf-8 | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from ..utils import ( | 
					
						
							|  |  |  |     sanitized_Request, | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |     xpath_text, | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  |     xpath_with_ns, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class RegioTVIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?regio-tv\.de/video/(?P<id>[0-9]+)' | 
					
						
							|  |  |  |     _TESTS = [{ | 
					
						
							|  |  |  |         'url': 'http://www.regio-tv.de/video/395808.html', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': '395808', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'Wir in Ludwigsburg', | 
					
						
							|  |  |  |             'description': 'Mit unseren zuckersüßen Adventskindern, außerdem besuchen wir die Abendsterne!', | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'http://www.regio-tv.de/video/395808', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							|  |  |  |     }] | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |         video_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |         key = self._search_regex( | 
					
						
							|  |  |  |             r'key\s*:\s*(["\'])(?P<key>.+?)\1', webpage, 'key', group='key') | 
					
						
							|  |  |  |         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>' | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |         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') | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         NS_MAP = { | 
					
						
							|  |  |  |             'xsi': 'http://www.w3.org/2001/XMLSchema-instance', | 
					
						
							|  |  |  |             'soap': 'http://schemas.xmlsoap.org/soap/envelope/', | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |         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( | 
					
						
							|  |  |  |             webpage) or self._html_search_meta('description', webpage) | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |             'url': video_url, | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  |             'title': title, | 
					
						
							|  |  |  |             'description': description, | 
					
						
							| 
									
										
										
										
											2015-12-31 22:12:47 +06:00
										 |  |  |             'thumbnail': thumbnail, | 
					
						
							| 
									
										
										
										
											2015-12-20 03:17:23 +01:00
										 |  |  |         } |