| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							|  |  |  | from ..utils import remove_end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class CharlieRoseIE(InfoExtractor): | 
					
						
							|  |  |  |     _VALID_URL = r'https?://(?:www\.)?charlierose\.com/video(?:s|/player)/(?P<id>\d+)' | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |     _TESTS = [{ | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  |         'url': 'https://charlierose.com/videos/27996', | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |         'md5': 'fda41d49e67d4ce7c2411fd2c4702e09', | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': '27996', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'Remembering Zaha Hadid', | 
					
						
							| 
									
										
										
										
											2017-01-02 20:08:07 +08:00
										 |  |  |             'thumbnail': r're:^https?://.*\.jpg\?\d+', | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  |             'description': 'We revisit past conversations with Zaha Hadid, in memory of the world renowned Iraqi architect.', | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |             'subtitles': { | 
					
						
							|  |  |  |                 'en': [{ | 
					
						
							|  |  |  |                     'ext': 'vtt', | 
					
						
							|  |  |  |                 }], | 
					
						
							|  |  |  |             }, | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  |         }, | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'https://charlierose.com/videos/27996', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							|  |  |  |     }] | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     _PLAYER_BASE = 'https://charlierose.com/video/player/%s' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |         video_id = self._match_id(url) | 
					
						
							|  |  |  |         webpage = self._download_webpage(self._PLAYER_BASE % video_id, video_id) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         title = remove_end(self._og_search_title(webpage), ' - Charlie Rose') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |         info_dict = self._parse_html5_media_entries( | 
					
						
							| 
									
										
										
										
											2016-08-22 02:18:46 +08:00
										 |  |  |             self._PLAYER_BASE % video_id, webpage, video_id, | 
					
						
							|  |  |  |             m3u8_entry_protocol='m3u8_native')[0] | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |         self._sort_formats(info_dict['formats']) | 
					
						
							|  |  |  |         self._remove_duplicate_formats(info_dict['formats']) | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |         info_dict.update({ | 
					
						
							| 
									
										
										
										
											2016-08-19 12:53:34 +02:00
										 |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							|  |  |  |             'thumbnail': self._og_search_thumbnail(webpage), | 
					
						
							|  |  |  |             'description': self._og_search_description(webpage), | 
					
						
							| 
									
										
										
										
											2016-08-22 02:06:47 +08:00
										 |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return info_dict |