2
from __future__ import unicode_literals
4
from .common import InfoExtractor
5
from .youtube import YoutubeIE
13
class Tele13IE(InfoExtractor):
14
_VALID_URL = r'^http://(?:www\.)?t13\.cl/videos(?:/[^/]+)+/(?P<id>[\w-]+)'
17
'url': 'http://www.t13.cl/videos/actualidad/el-circulo-de-hierro-de-michelle-bachelet-en-su-regreso-a-la-moneda',
18
'md5': '4cb1fa38adcad8fea88487a078831755',
20
'id': 'el-circulo-de-hierro-de-michelle-bachelet-en-su-regreso-a-la-moneda',
22
'title': 'El círculo de hierro de Michelle Bachelet en su regreso a La Moneda',
25
# HTTP Error 404: Not Found
26
'skip_download': True,
30
'url': 'http://www.t13.cl/videos/mundo/tendencias/video-captan-misteriosa-bola-fuego-cielos-bangkok',
31
'md5': '867adf6a3b3fef932c68a71d70b70946',
35
'title': 'Shooting star seen on 7-Sep-2015',
36
'description': 'md5:7292ff2a34b2f673da77da222ae77e1e',
37
'uploader': 'Porjai Jaturongkhakun',
38
'upload_date': '20150906',
39
'uploader_id': 'UCnLY_3ezwNcDSC_Wc6suZxw',
41
'add_ie': ['Youtube'],
45
def _real_extract(self, url):
46
display_id = self._match_id(url)
47
webpage = self._download_webpage(url, display_id)
49
setup_js = self._search_regex(r"(?s)jwplayer\('player-vivo'\).setup\((\{.*?\})\)", webpage, 'setup code')
50
sources = self._parse_json(self._search_regex(r'sources\s*:\s*(\[[^\]]+\])', setup_js, 'sources'), display_id, js_to_json)
52
preference = qualities(['Móvil', 'SD', 'HD'])
56
format_url = f['file']
57
if format_url and format_url not in urls:
58
ext = determine_ext(format_url)
60
m3u8_formats = self._extract_m3u8_formats(format_url, display_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
62
formats.extend(m3u8_formats)
63
elif YoutubeIE.suitable(format_url):
64
return self.url_result(format_url, 'Youtube')
68
'format_id': f.get('label'),
69
'preference': preference(f.get('label')),
72
urls.append(format_url)
73
self._sort_formats(formats)
77
'title': self._search_regex(r'title\s*:\s*"([^"]+)"', setup_js, 'title'),
78
'description': self._html_search_meta('description', webpage, 'description'),
79
'thumbnail': self._search_regex(r'image\s*:\s*"([^"]+)"', setup_js, 'thumbnail', default=None),