| 
									
										
										
										
											2016-10-02 13:39:18 +02:00
										 |  |  | # coding: utf-8 | 
					
						
							| 
									
										
										
										
											2015-02-27 15:41:58 +01:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  | from .prosiebensat1 import ProSiebenSat1BaseIE | 
					
						
							| 
									
										
										
										
											2015-02-28 22:25:57 +06:00
										 |  |  | from ..utils import ( | 
					
						
							|  |  |  |     unified_strdate, | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  |     parse_duration, | 
					
						
							|  |  |  |     compat_str, | 
					
						
							| 
									
										
										
										
											2015-02-28 22:25:57 +06:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2015-02-27 15:41:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  | class Puls4IE(ProSiebenSat1BaseIE): | 
					
						
							| 
									
										
										
										
											2016-11-25 23:37:32 +07:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?puls4\.com/(?P<id>[^?#&]+)' | 
					
						
							| 
									
										
										
										
											2015-02-27 15:41:58 +01:00
										 |  |  |     _TESTS = [{ | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  |         'url': 'http://www.puls4.com/2-minuten-2-millionen/staffel-3/videos/2min2miotalk/Tobias-Homberger-von-myclubs-im-2min2miotalk-118118', | 
					
						
							|  |  |  |         'md5': 'fd3c6b0903ac72c9d004f04bc6bb3e03', | 
					
						
							| 
									
										
										
										
											2015-02-27 15:41:58 +01:00
										 |  |  |         'info_dict': { | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  |             'id': '118118', | 
					
						
							|  |  |  |             'ext': 'flv', | 
					
						
							|  |  |  |             'title': 'Tobias Homberger von myclubs im #2min2miotalk', | 
					
						
							|  |  |  |             'description': 'md5:f9def7c5e8745d6026d8885487d91955', | 
					
						
							|  |  |  |             'upload_date': '20160830', | 
					
						
							| 
									
										
										
										
											2015-02-28 22:25:57 +06:00
										 |  |  |             'uploader': 'PULS_4', | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2016-11-25 23:37:32 +07:00
										 |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident.-Norbert-Hofer', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'http://www.puls4.com/pro-und-contra/wer-wird-prasident/Ganze-Folgen/Wer-wird-Praesident-Analyse-des-Interviews-mit-Norbert-Hofer-416598', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							| 
									
										
										
										
											2015-02-28 22:25:57 +06:00
										 |  |  |     }] | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  |     _TOKEN = 'puls4' | 
					
						
							|  |  |  |     _SALT = '01!kaNgaiNgah1Ie4AeSha' | 
					
						
							|  |  |  |     _CLIENT_NAME = '' | 
					
						
							| 
									
										
										
										
											2015-02-27 15:41:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							| 
									
										
										
										
											2016-09-07 14:43:20 +01:00
										 |  |  |         path = self._match_id(url) | 
					
						
							|  |  |  |         content_path = self._download_json( | 
					
						
							|  |  |  |             'http://www.puls4.com/api/json-fe/page/' + path, path)['content'][0]['url'] | 
					
						
							|  |  |  |         media = self._download_json( | 
					
						
							|  |  |  |             'http://www.puls4.com' + content_path, | 
					
						
							|  |  |  |             content_path)['mediaCurrent'] | 
					
						
							|  |  |  |         player_content = media['playerContent'] | 
					
						
							|  |  |  |         info = self._extract_video_info(url, player_content['id']) | 
					
						
							|  |  |  |         info.update({ | 
					
						
							|  |  |  |             'id': compat_str(media['objectId']), | 
					
						
							|  |  |  |             'title': player_content['title'], | 
					
						
							|  |  |  |             'description': media.get('description'), | 
					
						
							|  |  |  |             'thumbnail': media.get('previewLink'), | 
					
						
							|  |  |  |             'upload_date': unified_strdate(media.get('date')), | 
					
						
							|  |  |  |             'duration': parse_duration(player_content.get('duration')), | 
					
						
							|  |  |  |             'episode': player_content.get('episodePartName'), | 
					
						
							|  |  |  |             'show': media.get('channel'), | 
					
						
							|  |  |  |             'season_id': player_content.get('seasonId'), | 
					
						
							|  |  |  |             'uploader': player_content.get('sourceCompany'), | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         return info |