1 from .common
import InfoExtractor
2 from ..networking
import HEADRequest
3 from ..utils
import try_get
, unified_timestamp
6 class TelemundoIE(InfoExtractor
):
8 _VALID_URL
= r
'https?:\/\/(?:www\.)?telemundo\.com\/.+?video\/[^\/]+(?P<id>tmvo\d{7})'
10 'url': 'https://www.telemundo.com/noticias/noticias-telemundo-en-la-noche/empleo/video/esta-aplicacion-gratuita-esta-ayudando-los-latinos-encontrar-trabajo-en-estados-unidos-tmvo9829325',
13 'timestamp': 1621396800,
14 'title': 'Esta aplicación gratuita está ayudando a los latinos a encontrar trabajo en Estados Unidos',
15 'uploader': 'Telemundo',
16 'uploader_id': 'NBCU_Telemundo',
18 'upload_date': '20210519',
21 'skip_download': True,
24 'url': 'https://www.telemundo.com/shows/al-rojo-vivo/empleo/video/personajes-de-times-square-piden-que-la-ciudad-de-nueva-york-los-deje-volver-trabajar-tmvo9816272',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
31 metadata
= self
._search
_nextjs
_data
(webpage
, video_id
)
32 redirect_url
= try_get(
34 lambda x
: x
['props']['initialState']['video']['associatedPlaylists'][0]['videos'][0]['videoAssets'][0]['publicUrl'])
36 m3u8_url
= self
._request
_webpage
(HEADRequest(
37 redirect_url
+ '?format=redirect&manifest=m3u&format=redirect&Tracking=true&Embedded=true&formats=MPEG4'),
38 video_id
, 'Processing m3u8').url
39 formats
= self
._extract
_m
3u8_formats
(m3u8_url
, video_id
, 'mp4')
40 date
= unified_timestamp(try_get(
41 metadata
, lambda x
: x
['props']['initialState']['video']['associatedPlaylists'][0]['videos'][0]['datePublished'].split(' ', 1)[1]))
45 'title': self
._search
_regex
(r
'<h1[^>]+>([^<]+)', webpage
, 'title', fatal
=False),
48 'uploader': 'Telemundo',
49 'uploader_id': self
._search
_regex
(r
'https?:\/\/(?:[^/]+\/){3}video\/(?P<id>[^\/]+)', m3u8_url
, 'Akamai account', fatal
=False),