biobiochiletv.py 3.4 KB

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