3 from .common
import InfoExtractor
4 from ..utils
import traverse_obj
7 class TelecaribePlayIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:www\.)?play\.telecaribe\.co/(?P<id>[\w-]+)'
10 'url': 'https://www.play.telecaribe.co/breicok',
17 'url': 'https://www.play.telecaribe.co/si-fue-gol-de-yepes',
19 'id': 'si-fue-gol-de-yepes',
20 'title': 'Sí Fue Gol de Yepes',
24 'url': 'https://www.play.telecaribe.co/ciudad-futura',
26 'id': 'ciudad-futura',
27 'title': 'Ciudad Futura',
31 'url': 'https://www.play.telecaribe.co/live',
34 'title': r
're:^Señal en vivo',
35 'live_status': 'is_live',
39 'skip_download': 'Livestream',
42 'url': 'https://www.play.telecaribe.co/liveplus',
45 'title': r
're:^Señal en vivo Plus',
46 'live_status': 'is_live',
50 'skip_download': 'Livestream',
52 'skip': 'Geo-restricted to Colombia',
55 def _download_player_webpage(self
, webpage
, display_id
):
56 page_id
= self
._search
_regex
(
57 (r
'window\.firstPageId\s*=\s*["\']([^
"\']+)', r'<div[^>]+id\s*=\s*"pageBackground_([^
"]+)'),
60 props = self._download_json(self._search_regex(
61 rf'<link[^>]+href\s*=\s*"([^
"]+)"[^
>]+id\s
*=\s
*"features_{page_id}"',
62 webpage, 'json_props_url
'), display_id)['props
']['render
']['compProps
']
64 return self._download_webpage(traverse_obj(props, (..., 'url
'))[-1], display_id)
66 def _get_clean_title(self, title):
67 return re.sub(r'\s
*\|\s
*Telecaribe\s
*VOD
', '', title or '').strip() or None
69 def _real_extract(self, url):
70 display_id = self._match_id(url)
71 webpage = self._download_webpage(url, display_id)
72 player = self._download_player_webpage(webpage, display_id)
74 livestream_url = self._search_regex(
75 r'(?
:let|const|var
)\s
+source\s
*=\s
*["\']([^"\']+)', player, 'm3u8 url
', default=None)
77 if not livestream_url:
78 return self.playlist_from_matches(
79 re.findall(r'<a
[^
>]+href\s
*=\s
*"([^"]+\
.mp4
)', player), display_id,
80 self._get_clean_title(self._og_search_title(webpage)))
82 formats, subtitles = self._extract_m3u8_formats_and_subtitles(
83 livestream_url, display_id, 'mp4
', live=True)
87 'title
': self._get_clean_title(self._og_search_title(webpage)),
89 'subtitles
': subtitles,