]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/biobiochiletv.py
Fix "invalid escape sequences" error on Python 3.6
[yt-dlp.git] / youtube_dl / extractor / biobiochiletv.py
CommitLineData
fa023ccb
S
1# coding: utf-8
2from __future__ import unicode_literals
3
4from .common import InfoExtractor
b99af8a5
YCH
5from ..utils import (
6 ExtractorError,
7 remove_end,
8)
9from .rudo import RudoIE
fa023ccb
S
10
11
12class BioBioChileTVIE(InfoExtractor):
b99af8a5 13 _VALID_URL = r'https?://(?:tv|www)\.biobiochile\.cl/(?:notas|noticias)/(?:[^/]+/)+(?P<id>[^/]+)\.shtml'
fa023ccb
S
14
15 _TESTS = [{
16 'url': 'http://tv.biobiochile.cl/notas/2015/10/21/sobre-camaras-y-camarillas-parlamentarias.shtml',
17 'md5': '26f51f03cf580265defefb4518faec09',
18 'info_dict': {
19 'id': 'sobre-camaras-y-camarillas-parlamentarias',
20 'ext': 'mp4',
21 'title': 'Sobre Cámaras y camarillas parlamentarias',
ec85ded8 22 'thumbnail': r're:^https?://.*\.jpg$',
fa023ccb
S
23 'uploader': 'Fernando Atria',
24 },
b99af8a5 25 'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html',
fa023ccb
S
26 }, {
27 # different uploader layout
28 'url': 'http://tv.biobiochile.cl/notas/2016/03/18/natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades.shtml',
29 'md5': 'edc2e6b58974c46d5b047dea3c539ff3',
30 'info_dict': {
31 'id': 'natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades',
32 'ext': 'mp4',
33 'title': 'Natalia Valdebenito repasa a diputado Hasbún: Pasó a la categoría de hablar brutalidades',
ec85ded8 34 'thumbnail': r're:^https?://.*\.jpg$',
fa023ccb
S
35 'uploader': 'Piangella Obrador',
36 },
37 'params': {
38 'skip_download': True,
39 },
b99af8a5
YCH
40 'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html',
41 }, {
42 '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',
43 'info_dict': {
44 'id': 'edecanes-del-congreso-figuras-decorativas-que-le-cuestan-muy-caro-a-los-chilenos',
45 'ext': 'mp4',
46 'uploader': '(none)',
47 'upload_date': '20160708',
48 'title': 'Edecanes del Congreso: Figuras decorativas que le cuestan muy caro a los chilenos',
49 },
fa023ccb
S
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,
56 }]
57
58 def _real_extract(self, url):
59 video_id = self._match_id(url)
60
61 webpage = self._download_webpage(url, video_id)
62
b99af8a5
YCH
63 rudo_url = RudoIE._extract_url(webpage)
64 if not rudo_url:
65 raise ExtractorError('No videos found')
fa023ccb 66
b99af8a5 67 title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV')
fa023ccb
S
68
69 thumbnail = self._og_search_thumbnail(webpage)
70 uploader = self._html_search_regex(
b99af8a5 71 r'<a[^>]+href=["\']https?://(?:busca|www)\.biobiochile\.cl/(?:lista/)?(?:author|autor)[^>]+>(.+?)</a>',
fa023ccb
S
72 webpage, 'uploader', fatal=False)
73
74 return {
b99af8a5
YCH
75 '_type': 'url_transparent',
76 'url': rudo_url,
fa023ccb
S
77 'id': video_id,
78 'title': title,
79 'thumbnail': thumbnail,
80 'uploader': uploader,
fa023ccb 81 }