[cleanup] Misc (#8968)
[yt-dlp.git] / yt_dlp / extractor / biobiochiletv.py
blob180c9656e3556a7b54e5444dbe439b51161396f8
1 from .common import InfoExtractor
2 from ..utils import (
3 ExtractorError,
4 remove_end,
8 class BioBioChileTVIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:tv|www)\.biobiochile\.cl/(?:notas|noticias)/(?:[^/]+/)+(?P<id>[^/]+)\.shtml'
11 _TESTS = [{
12 'url': 'http://tv.biobiochile.cl/notas/2015/10/21/sobre-camaras-y-camarillas-parlamentarias.shtml',
13 'md5': '26f51f03cf580265defefb4518faec09',
14 'info_dict': {
15 'id': 'sobre-camaras-y-camarillas-parlamentarias',
16 'ext': 'mp4',
17 'title': 'Sobre Cámaras y camarillas parlamentarias',
18 'thumbnail': r're:^https?://.*\.jpg$',
19 'uploader': 'Fernando Atria',
21 'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html',
22 }, {
23 # different uploader layout
24 'url': 'http://tv.biobiochile.cl/notas/2016/03/18/natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades.shtml',
25 'md5': 'edc2e6b58974c46d5b047dea3c539ff3',
26 'info_dict': {
27 'id': 'natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades',
28 'ext': 'mp4',
29 'title': 'Natalia Valdebenito repasa a diputado Hasbún: Pasó a la categoría de hablar brutalidades',
30 'thumbnail': r're:^https?://.*\.jpg$',
31 'uploader': 'Piangella Obrador',
33 'params': {
34 'skip_download': True,
36 'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html',
37 }, {
38 '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',
39 'info_dict': {
40 'id': 'b4xd0LK3SK',
41 'ext': 'mp4',
42 # TODO: fix url_transparent information overriding
43 # 'uploader': 'Juan Pablo Echenique',
44 'title': 'Comentario Oscar Cáceres',
46 'params': {
47 # empty m3u8 manifest
48 'skip_download': True,
50 }, {
51 'url': 'http://tv.biobiochile.cl/notas/2015/10/22/ninos-transexuales-de-quien-es-la-decision.shtml',
52 'only_matching': True,
53 }, {
54 'url': 'http://tv.biobiochile.cl/notas/2015/10/21/exclusivo-hector-pinto-formador-de-chupete-revela-version-del-ex-delantero-albo.shtml',
55 'only_matching': True,
58 def _real_extract(self, url):
59 video_id = self._match_id(url)
61 webpage = self._download_webpage(url, video_id)
63 rudo_url = self._search_regex(
64 r'<iframe[^>]+src=(?P<q1>[\'"])(?P<url>(?:https?:)?//rudo\.video/vod/[0-9a-zA-Z]+)(?P=q1)',
65 webpage, 'embed URL', None, group='url')
66 if not rudo_url:
67 raise ExtractorError('No videos found')
69 title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV')
71 thumbnail = self._og_search_thumbnail(webpage)
72 uploader = self._html_search_regex(
73 r'<a[^>]+href=["\'](?:https?://(?:busca|www)\.biobiochile\.cl)?/(?:lista/)?(?:author|autor)[^>]+>(.+?)</a>',
74 webpage, 'uploader', fatal=False)
76 return {
77 '_type': 'url_transparent',
78 'url': rudo_url,
79 'id': video_id,
80 'title': title,
81 'thumbnail': thumbnail,
82 'uploader': uploader,