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.4 KiB

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