1 from .common
import InfoExtractor
2 from .youtube
import YoutubeIE
10 class Tele13IE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?t13\.cl/videos(?:/[^/]+)+/(?P<id>[\w-]+)'
14 'url': 'http://www.t13.cl/videos/actualidad/el-circulo-de-hierro-de-michelle-bachelet-en-su-regreso-a-la-moneda',
15 'md5': '4cb1fa38adcad8fea88487a078831755',
17 'id': 'el-circulo-de-hierro-de-michelle-bachelet-en-su-regreso-a-la-moneda',
19 'title': 'El círculo de hierro de Michelle Bachelet en su regreso a La Moneda',
22 # HTTP Error 404: Not Found
23 'skip_download': True,
27 'url': 'http://www.t13.cl/videos/mundo/tendencias/video-captan-misteriosa-bola-fuego-cielos-bangkok',
28 'md5': '867adf6a3b3fef932c68a71d70b70946',
32 'title': 'Shooting star seen on 7-Sep-2015',
33 'description': 'md5:7292ff2a34b2f673da77da222ae77e1e',
34 'uploader': 'Porjai Jaturongkhakun',
35 'upload_date': '20150906',
36 'uploader_id': 'UCnLY_3ezwNcDSC_Wc6suZxw',
38 'add_ie': ['Youtube'],
42 def _real_extract(self
, url
):
43 display_id
= self
._match
_id
(url
)
44 webpage
= self
._download
_webpage
(url
, display_id
)
46 setup_js
= self
._search
_regex
(
47 r
"(?s)jwplayer\('player-vivo'\).setup\((\{.*?\})\)",
48 webpage
, 'setup code')
49 sources
= self
._parse
_json
(self
._search
_regex
(
50 r
'sources\s*:\s*(\[[^\]]+\])', setup_js
, 'sources'),
51 display_id
, js_to_json
)
53 preference
= qualities(['Móvil', 'SD', 'HD'])
57 format_url
= f
['file']
58 if format_url
and format_url
not in urls
:
59 ext
= determine_ext(format_url
)
61 formats
.extend(self
._extract
_m
3u8_formats
(
62 format_url
, display_id
, 'mp4', 'm3u8_native',
63 m3u8_id
='hls', fatal
=False))
64 elif YoutubeIE
.suitable(format_url
):
65 return self
.url_result(format_url
, 'Youtube')
69 'format_id': f
.get('label'),
70 'quality': preference(f
.get('label')),
73 urls
.append(format_url
)
77 'title': self
._search
_regex
(
78 r
'title\s*:\s*"([^"]+)"', setup_js
, 'title'),
79 'description': self
._html
_search
_meta
(
80 'description', webpage
, 'description'),
81 'thumbnail': self
._search
_regex
(
82 r
'image\s*:\s*"([^"]+)"', setup_js
, 'thumbnail', default
=None),