diff options
| -rw-r--r-- | youtube_dl/extractor/biobiochiletv.py | 53 | 
1 files changed, 24 insertions, 29 deletions
| diff --git a/youtube_dl/extractor/biobiochiletv.py b/youtube_dl/extractor/biobiochiletv.py index 133228133..7608c0a08 100644 --- a/youtube_dl/extractor/biobiochiletv.py +++ b/youtube_dl/extractor/biobiochiletv.py @@ -2,11 +2,15 @@  from __future__ import unicode_literals  from .common import InfoExtractor -from ..utils import remove_end +from ..utils import ( +    ExtractorError, +    remove_end, +) +from .rudo import RudoIE  class BioBioChileTVIE(InfoExtractor): -    _VALID_URL = r'https?://tv\.biobiochile\.cl/notas/(?:[^/]+/)+(?P<id>[^/]+)\.shtml' +    _VALID_URL = r'https?://(?:tv|www)\.biobiochile\.cl/(?:notas|noticias)/(?:[^/]+/)+(?P<id>[^/]+)\.shtml'      _TESTS = [{          'url': 'http://tv.biobiochile.cl/notas/2015/10/21/sobre-camaras-y-camarillas-parlamentarias.shtml', @@ -18,6 +22,7 @@ class BioBioChileTVIE(InfoExtractor):              'thumbnail': 're:^https?://.*\.jpg$',              'uploader': 'Fernando Atria',          }, +        'skip': 'URL expired and redirected to http://www.biobiochile.cl/portada/bbtv/index.html',      }, {          # 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', @@ -32,6 +37,16 @@ class BioBioChileTVIE(InfoExtractor):          'params': {              'skip_download': True,          }, +        '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', +        },      }, {          'url': 'http://tv.biobiochile.cl/notas/2015/10/22/ninos-transexuales-de-quien-es-la-decision.shtml',          'only_matching': True, @@ -45,42 +60,22 @@ class BioBioChileTVIE(InfoExtractor):          webpage = self._download_webpage(url, video_id) -        title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV') +        rudo_url = RudoIE._extract_url(webpage) +        if not rudo_url: +            raise ExtractorError('No videos found') -        file_url = self._search_regex( -            r'loadFWPlayerVideo\([^,]+,\s*(["\'])(?P<url>.+?)\1', -            webpage, 'file url', group='url') - -        base_url = self._search_regex( -            r'file\s*:\s*(["\'])(?P<url>.+?)\1\s*\+\s*fileURL', webpage, -            'base url', default='http://unlimited2-cl.digitalproserver.com/bbtv/', -            group='url') - -        formats = self._extract_m3u8_formats( -            '%s%s/playlist.m3u8' % (base_url, file_url), video_id, 'mp4', -            entry_protocol='m3u8_native', m3u8_id='hls', fatal=False) -        f = { -            'url': '%s%s' % (base_url, file_url), -            'format_id': 'http', -            'protocol': 'http', -            'preference': 1, -        } -        if formats: -            f_copy = formats[-1].copy() -            f_copy.update(f) -            f = f_copy -        formats.append(f) -        self._sort_formats(formats) +        title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV')          thumbnail = self._og_search_thumbnail(webpage)          uploader = self._html_search_regex( -            r'<a[^>]+href=["\']https?://busca\.biobiochile\.cl/author[^>]+>(.+?)</a>', +            r'<a[^>]+href=["\']https?://(?:busca|www)\.biobiochile\.cl/(?:lista/)?(?:author|autor)[^>]+>(.+?)</a>',              webpage, 'uploader', fatal=False)          return { +            '_type': 'url_transparent', +            'url': rudo_url,              'id': video_id,              'title': title,              'thumbnail': thumbnail,              'uploader': uploader, -            'formats': formats,          } | 
