You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
3.2 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import remove_end
  5. class BioBioChileTVIE(InfoExtractor):
  6. _VALID_URL = r'https?://tv\.biobiochile\.cl/notas/(?:[^/]+/)+(?P<id>[^/]+)\.shtml'
  7. _TESTS = [{
  8. 'url': 'http://tv.biobiochile.cl/notas/2015/10/21/sobre-camaras-y-camarillas-parlamentarias.shtml',
  9. 'md5': '26f51f03cf580265defefb4518faec09',
  10. 'info_dict': {
  11. 'id': 'sobre-camaras-y-camarillas-parlamentarias',
  12. 'ext': 'mp4',
  13. 'title': 'Sobre Cámaras y camarillas parlamentarias',
  14. 'thumbnail': 're:^https?://.*\.jpg$',
  15. 'uploader': 'Fernando Atria',
  16. },
  17. }, {
  18. # different uploader layout
  19. 'url': 'http://tv.biobiochile.cl/notas/2016/03/18/natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades.shtml',
  20. 'md5': 'edc2e6b58974c46d5b047dea3c539ff3',
  21. 'info_dict': {
  22. 'id': 'natalia-valdebenito-repasa-a-diputado-hasbun-paso-a-la-categoria-de-hablar-brutalidades',
  23. 'ext': 'mp4',
  24. 'title': 'Natalia Valdebenito repasa a diputado Hasbún: Pasó a la categoría de hablar brutalidades',
  25. 'thumbnail': 're:^https?://.*\.jpg$',
  26. 'uploader': 'Piangella Obrador',
  27. },
  28. 'params': {
  29. 'skip_download': True,
  30. },
  31. }, {
  32. 'url': 'http://tv.biobiochile.cl/notas/2015/10/22/ninos-transexuales-de-quien-es-la-decision.shtml',
  33. 'only_matching': True,
  34. }, {
  35. 'url': 'http://tv.biobiochile.cl/notas/2015/10/21/exclusivo-hector-pinto-formador-de-chupete-revela-version-del-ex-delantero-albo.shtml',
  36. 'only_matching': True,
  37. }]
  38. def _real_extract(self, url):
  39. video_id = self._match_id(url)
  40. webpage = self._download_webpage(url, video_id)
  41. title = remove_end(self._og_search_title(webpage), ' - BioBioChile TV')
  42. file_url = self._search_regex(
  43. r'loadFWPlayerVideo\([^,]+,\s*(["\'])(?P<url>.+?)\1',
  44. webpage, 'file url', group='url')
  45. base_url = self._search_regex(
  46. r'file\s*:\s*(["\'])(?P<url>.+?)\1\s*\+\s*fileURL', webpage,
  47. 'base url', default='http://unlimited2-cl.digitalproserver.com/bbtv/',
  48. group='url')
  49. formats = self._extract_m3u8_formats(
  50. '%s%s/playlist.m3u8' % (base_url, file_url), video_id, 'mp4',
  51. entry_protocol='m3u8_native', m3u8_id='hls', fatal=False)
  52. f = {
  53. 'url': '%s%s' % (base_url, file_url),
  54. 'format_id': 'http',
  55. 'protocol': 'http',
  56. 'preference': 1,
  57. }
  58. if formats:
  59. f_copy = formats[-1].copy()
  60. f_copy.update(f)
  61. f = f_copy
  62. formats.append(f)
  63. self._sort_formats(formats)
  64. thumbnail = self._og_search_thumbnail(webpage)
  65. uploader = self._html_search_regex(
  66. r'<a[^>]+href=["\']https?://busca\.biobiochile\.cl/author[^>]+>(.+?)</a>',
  67. webpage, 'uploader', fatal=False)
  68. return {
  69. 'id': video_id,
  70. 'title': title,
  71. 'thumbnail': thumbnail,
  72. 'uploader': uploader,
  73. 'formats': formats,
  74. }