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.

93 lines
3.4 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. int_or_none,
  6. parse_iso8601,
  7. smuggle_url,
  8. )
  9. class MiTeleIE(InfoExtractor):
  10. IE_DESC = 'mitele.es'
  11. _VALID_URL = r'https?://(?:www\.)?mitele\.es/(?:[^/]+/)+(?P<id>[^/]+)/player'
  12. _TESTS = [{
  13. 'url': 'http://www.mitele.es/programas-tv/diario-de/57b0dfb9c715da65618b4afa/player',
  14. 'info_dict': {
  15. 'id': 'FhYW1iNTE6J6H7NkQRIEzfne6t2quqPg',
  16. 'ext': 'mp4',
  17. 'title': 'Diario de La redacción Programa 144',
  18. 'description': 'md5:07c35a7b11abb05876a6a79185b58d27',
  19. 'series': 'Diario de',
  20. 'season': 'Season 14',
  21. 'season_number': 14,
  22. 'episode': 'Tor, la web invisible',
  23. 'episode_number': 3,
  24. 'thumbnail': r're:(?i)^https?://.*\.jpg$',
  25. 'duration': 2913,
  26. 'age_limit': 16,
  27. 'timestamp': 1471209401,
  28. 'upload_date': '20160814',
  29. },
  30. 'add_ie': ['Ooyala'],
  31. }, {
  32. # no explicit title
  33. 'url': 'http://www.mitele.es/programas-tv/cuarto-milenio/57b0de3dc915da14058b4876/player',
  34. 'info_dict': {
  35. 'id': 'oyNG1iNTE6TAPP-JmCjbwfwJqqMMX3Vq',
  36. 'ext': 'mp4',
  37. 'title': 'Cuarto Milenio Temporada 6 Programa 226',
  38. 'description': 'md5:5ff132013f0cd968ffbf1f5f3538a65f',
  39. 'series': 'Cuarto Milenio',
  40. 'season': 'Season 6',
  41. 'season_number': 6,
  42. 'episode': 'Episode 24',
  43. 'episode_number': 24,
  44. 'thumbnail': r're:(?i)^https?://.*\.jpg$',
  45. 'duration': 7313,
  46. 'age_limit': 12,
  47. 'timestamp': 1471209021,
  48. 'upload_date': '20160814',
  49. },
  50. 'params': {
  51. 'skip_download': True,
  52. },
  53. 'add_ie': ['Ooyala'],
  54. }, {
  55. 'url': 'http://www.mitele.es/series-online/la-que-se-avecina/57aac5c1c915da951a8b45ed/player',
  56. 'only_matching': True,
  57. }, {
  58. 'url': 'https://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144-40_1006364575251/player/',
  59. 'only_matching': True,
  60. }]
  61. def _real_extract(self, url):
  62. display_id = self._match_id(url)
  63. webpage = self._download_webpage(url, display_id)
  64. pre_player = self._parse_json(self._search_regex(
  65. r'window\.\$REACTBASE_STATE\.prePlayer_mtweb\s*=\s*({.+})',
  66. webpage, 'Pre Player'), display_id)['prePlayer']
  67. title = pre_player['title']
  68. video = pre_player['video']
  69. video_id = video['dataMediaId']
  70. content = pre_player.get('content') or {}
  71. info = content.get('info') or {}
  72. return {
  73. '_type': 'url_transparent',
  74. # for some reason only HLS is supported
  75. 'url': smuggle_url('ooyala:' + video_id, {'supportedformats': 'm3u8,dash'}),
  76. 'id': video_id,
  77. 'title': title,
  78. 'description': info.get('synopsis'),
  79. 'series': content.get('title'),
  80. 'season_number': int_or_none(info.get('season_number')),
  81. 'episode': content.get('subtitle'),
  82. 'episode_number': int_or_none(info.get('episode_number')),
  83. 'duration': int_or_none(info.get('duration')),
  84. 'thumbnail': video.get('dataPoster'),
  85. 'age_limit': int_or_none(info.get('rating')),
  86. 'timestamp': parse_iso8601(pre_player.get('publishedTime')),
  87. }