| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  | # coding: utf-8 | 
					
						
							|  |  |  | from __future__ import unicode_literals | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from .common import InfoExtractor | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  | from ..utils import ( | 
					
						
							|  |  |  |     ExtractorError, | 
					
						
							|  |  |  |     remove_end, | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | from .rudo import RudoIE | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class BioBioChileTVIE(InfoExtractor): | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |     _VALID_URL = r'https?://(?:tv|www)\.biobiochile\.cl/(?:notas|noticias)/(?:[^/]+/)+(?P<id>[^/]+)\.shtml' | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  | 
 | 
					
						
							|  |  |  |     _TESTS = [{ | 
					
						
							|  |  |  |         'url': 'http://tv.biobiochile.cl/notas/2015/10/21/sobre-camaras-y-camarillas-parlamentarias.shtml', | 
					
						
							|  |  |  |         'md5': '26f51f03cf580265defefb4518faec09', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': 'sobre-camaras-y-camarillas-parlamentarias', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'Sobre Cámaras y camarillas parlamentarias', | 
					
						
							| 
									
										
										
										
											2017-01-02 20:08:07 +08:00
										 |  |  |             'thumbnail': r're:^https?://.*\.jpg$', | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  |             'uploader': 'Fernando Atria', | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |         'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html', | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  |     }, { | 
					
						
							|  |  |  |         # different uploader layout | 
					
						
							|  |  |  |         'url': 'http://tv.biobiochile.cl/notas/2016/03/18/natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades.shtml', | 
					
						
							|  |  |  |         'md5': 'edc2e6b58974c46d5b047dea3c539ff3', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': 'natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'title': 'Natalia Valdebenito repasa a diputado Hasbún: Pasó a la categoría de hablar brutalidades', | 
					
						
							| 
									
										
										
										
											2017-01-02 20:08:07 +08:00
										 |  |  |             'thumbnail': r're:^https?://.*\.jpg$', | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  |             'uploader': 'Piangella Obrador', | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         'params': { | 
					
						
							|  |  |  |             'skip_download': True, | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |         'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html', | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'http://www.biobiochile.cl/noticias/bbtv/comentarios-bio-bio/2016/07/08/edecanes-del-congreso-figuras-decorativas-que-le-cuestan-muy-caro-a-los-chilenos.shtml', | 
					
						
							|  |  |  |         'info_dict': { | 
					
						
							|  |  |  |             'id': 'edecanes-del-congreso-figuras-decorativas-que-le-cuestan-muy-caro-a-los-chilenos', | 
					
						
							|  |  |  |             'ext': 'mp4', | 
					
						
							|  |  |  |             'uploader': '(none)', | 
					
						
							|  |  |  |             'upload_date': '20160708', | 
					
						
							|  |  |  |             'title': 'Edecanes del Congreso: Figuras decorativas que le cuestan muy caro a los chilenos', | 
					
						
							|  |  |  |         }, | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'http://tv.biobiochile.cl/notas/2015/10/22/ninos-transexuales-de-quien-es-la-decision.shtml', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							|  |  |  |     }, { | 
					
						
							|  |  |  |         'url': 'http://tv.biobiochile.cl/notas/2015/10/21/exclusivo-hector-pinto-formador-de-chupete-revela-version-del-ex-delantero-albo.shtml', | 
					
						
							|  |  |  |         'only_matching': True, | 
					
						
							|  |  |  |     }] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def _real_extract(self, url): | 
					
						
							|  |  |  |         video_id = self._match_id(url) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         webpage = self._download_webpage(url, video_id) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |         rudo_url = RudoIE._extract_url(webpage) | 
					
						
							|  |  |  |         if not rudo_url: | 
					
						
							|  |  |  |             raise ExtractorError('No videos found') | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |         title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV') | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  | 
 | 
					
						
							|  |  |  |         thumbnail = self._og_search_thumbnail(webpage) | 
					
						
							|  |  |  |         uploader = self._html_search_regex( | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |             r'<a[^>]+href=["\']https?://(?:busca|www)\.biobiochile\.cl/(?:lista/)?(?:author|autor)[^>]+>(.+?)</a>', | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  |             webpage, 'uploader', fatal=False) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return { | 
					
						
							| 
									
										
										
										
											2016-07-11 13:23:57 +08:00
										 |  |  |             '_type': 'url_transparent', | 
					
						
							|  |  |  |             'url': rudo_url, | 
					
						
							| 
									
										
										
										
											2016-03-20 01:31:55 +06:00
										 |  |  |             'id': video_id, | 
					
						
							|  |  |  |             'title': title, | 
					
						
							|  |  |  |             'thumbnail': thumbnail, | 
					
						
							|  |  |  |             'uploader': uploader, | 
					
						
							|  |  |  |         } |