| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  | # coding: utf-8 | 
					
						
							|  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							| 
									
										
										
										
											2015-02-03 10:15:05 +01:00
										 |  |  | from ..utils import ( | 
					
						
							|  |  |  |     determine_ext, | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |     unified_strdate, | 
					
						
							| 
									
										
										
										
											2015-02-03 10:15:05 +01:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FranceCultureIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |     _VALID_URL = r'https?://(?:www\.)?franceculture\.fr/emissions/(?:[^/]+/)*(?P<id>[^/?#&]+)' | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |     _TEST = { | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |         'url': 'http://www.franceculture.fr/emissions/carnet-nomade/rendez-vous-au-pays-des-geeks', | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |         'info_dict': { | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |             'id': 'rendez-vous-au-pays-des-geeks', | 
					
						
							|  |  |  |             'display_id': 'rendez-vous-au-pays-des-geeks', | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |             'ext': 'mp3', | 
					
						
							|  |  |  |             'title': 'Rendez-vous au pays des geeks', | 
					
						
							| 
									
										
										
										
											2017-01-02 20:08:07 +08:00
										 |  |  |             'thumbnail': r're:^https?://.*\.jpg$', | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |             'upload_date': '20140301', | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |             'vcodec': 'none', | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |         display_id = self._match_id(url) | 
					
						
							| 
									
										
										
										
											2015-02-03 10:15:05 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |         webpage = self._download_webpage(url, display_id) | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |         video_url = self._search_regex( | 
					
						
							| 
									
										
										
										
											2016-11-08 22:26:33 +07:00
										 |  |  |             r'(?s)<div[^>]+class="[^"]*?title-zone-diffusion[^"]*?"[^>]*>.*?<button[^>]+data-asset-source="([^"]+)"', | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |             webpage, 'video path') | 
					
						
							| 
									
										
										
										
											2015-12-27 15:30:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |         title = self._og_search_title(webpage) | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |         upload_date = unified_strdate(self._search_regex( | 
					
						
							|  |  |  |             '(?s)<div[^>]+class="date"[^>]*>.*?<span[^>]+class="inner"[^>]*>([^<]+)<', | 
					
						
							|  |  |  |             webpage, 'upload date', fatal=False)) | 
					
						
							|  |  |  |         thumbnail = self._search_regex( | 
					
						
							| 
									
										
										
										
											2016-11-08 22:26:33 +07:00
										 |  |  |             r'(?s)<figure[^>]+itemtype="https://schema.org/ImageObject"[^>]*>.*?<img[^>]+data-dejavu-src="([^"]+)"', | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |             webpage, 'thumbnail', fatal=False) | 
					
						
							| 
									
										
										
										
											2015-02-03 10:15:05 +01:00
										 |  |  |         uploader = self._html_search_regex( | 
					
						
							|  |  |  |             r'(?s)<div id="emission".*?<span class="author">(.*?)</span>', | 
					
						
							|  |  |  |             webpage, 'uploader', default=None) | 
					
						
							|  |  |  |         vcodec = 'none' if determine_ext(video_url.lower()) == 'mp3' else None | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |             'id': display_id, | 
					
						
							|  |  |  |             'display_id': display_id, | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |             'url': video_url, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							|  |  |  |             'thumbnail': thumbnail, | 
					
						
							| 
									
										
										
										
											2016-08-13 21:00:34 +07:00
										 |  |  |             'vcodec': vcodec, | 
					
						
							|  |  |  |             'uploader': uploader, | 
					
						
							|  |  |  |             'upload_date': upload_date, | 
					
						
							| 
									
										
										
										
											2014-04-03 08:55:38 +02:00
										 |  |  |         } |