| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  | # coding: utf-8 | 
					
						
							|  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-16 23:42:36 +08:00
										 |  |  | from .common import InfoExtractor | 
					
						
							| 
									
										
										
										
											2016-09-05 13:37:36 +08:00
										 |  |  | from ..utils import ( | 
					
						
							|  |  |  |     clean_html, | 
					
						
							|  |  |  |     get_element_by_class, | 
					
						
							|  |  |  |     js_to_json, | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-16 23:42:36 +08:00
										 |  |  | class TVNoeIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2016-09-08 22:44:34 +07:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?tvnoe\.cz/video/(?P<id>[0-9]+)' | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  |     _TEST = { | 
					
						
							|  |  |  |         'url': 'http://www.tvnoe.cz/video/10362', | 
					
						
							|  |  |  |         'md5': 'aee983f279aab96ec45ab6e2abb3c2ca', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': '10362', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'series': 'Noční univerzita', | 
					
						
							| 
									
										
										
										
											2016-09-05 13:37:36 +08:00
										 |  |  |             'title': 'prof. Tomáš Halík, Th.D. - Návrat náboženství a střet civilizací', | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  |             'description': 'md5:f337bae384e1a531a52c55ebc50fff41', | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |         video_id = self._match_id(url) | 
					
						
							|  |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-05 13:37:36 +08:00
										 |  |  |         iframe_url = self._search_regex( | 
					
						
							|  |  |  |             r'<iframe[^>]+src="([^"]+)"', webpage, 'iframe URL') | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         ifs_page = self._download_webpage(iframe_url, video_id) | 
					
						
							| 
									
										
										
										
											2016-09-05 13:37:36 +08:00
										 |  |  |         jwplayer_data = self._parse_json( | 
					
						
							|  |  |  |             self._find_jwplayer_data(ifs_page), | 
					
						
							|  |  |  |             video_id, transform_source=js_to_json) | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  |         info_dict = self._parse_jwplayer_data( | 
					
						
							|  |  |  |             jwplayer_data, video_id, require_title=False, base_url=iframe_url) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         info_dict.update({ | 
					
						
							|  |  |  |             'id': video_id, | 
					
						
							| 
									
										
										
										
											2016-09-05 13:37:36 +08:00
										 |  |  |             'title': clean_html(get_element_by_class( | 
					
						
							|  |  |  |                 'field-name-field-podnazev', webpage)), | 
					
						
							|  |  |  |             'description': clean_html(get_element_by_class( | 
					
						
							|  |  |  |                 'field-name-body', webpage)), | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  |             'series': clean_html(get_element_by_class('title', webpage)) | 
					
						
							|  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2016-09-05 13:37:36 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-01 17:31:08 +02:00
										 |  |  |         return info_dict |