]> Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/biobiochiletv.py
debian/changelog: Annotate with another bug being closed.
[youtubedl] / youtube_dl / extractor / biobiochiletv.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 ExtractorError,
7 remove_end,
8 )
9 from .rudo import RudoIE
10
11
12 class BioBioChileTVIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:tv|www)\.biobiochile\.cl/(?:notas|noticias)/(?:[^/]+/)+(?P<id>[^/]+)\.shtml'
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',
22 'thumbnail': r're:^https?://.*\.jpg$',
23 'uploader': 'Fernando Atria',
24 },
25 'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html',
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',
34 'thumbnail': r're:^https?://.*\.jpg$',
35 'uploader': 'Piangella Obrador',
36 },
37 'params': {
38 'skip_download': True,
39 },
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 },
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
63 rudo_url = RudoIE._extract_url(webpage)
64 if not rudo_url:
65 raise ExtractorError('No videos found')
66
67 title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV')
68
69 thumbnail = self._og_search_thumbnail(webpage)
70 uploader = self._html_search_regex(
71 r'<a[^>]+href=["\']https?://(?:busca|www)\.biobiochile\.cl/(?:lista/)?(?:author|autor)[^>]+>(.+?)</a>',
72 webpage, 'uploader', fatal=False)
73
74 return {
75 '_type': 'url_transparent',
76 'url': rudo_url,
77 'id': video_id,
78 'title': title,
79 'thumbnail': thumbnail,
80 'uploader': uploader,
81 }