2 from __future__ import unicode_literals
6 from .common import InfoExtractor
16 class UOLIE(InfoExtractor):
17 IE_NAME = 'uol.com.br'
18 _VALID_URL = r'https?://(?:.+?\.)?uol\.com\.br/.*?(?:(?:mediaId|v)=|view/(?:[a-z0-9]+/)?|video(?:=|/(?:\d{4}/\d{2}/\d{2}/)?))(?P<id>\d+|[\w-]+-[A-Z0-9]+)'
20 'url': 'http://player.mais.uol.com.br/player_video_v3.swf?mediaId=15951931',
21 'md5': '25291da27dc45e0afb5718a8603d3816',
25 'title': 'Miss simpatia é encontrada morta',
26 'description': 'md5:3f8c11a0c0556d66daf7e5b45ef823b2',
29 'url': 'http://tvuol.uol.com.br/video/incendio-destroi-uma-das-maiores-casas-noturnas-de-londres-04024E9A3268D4C95326',
30 'md5': 'e41a2fb7b7398a3a46b6af37b15c00c9',
34 'title': 'Incêndio destrói uma das maiores casas noturnas de Londres',
35 'description': 'Em Londres, um incêndio destruiu uma das maiores boates da cidade. Não há informações sobre vítimas.',
38 'url': 'http://mais.uol.com.br/static/uolplayer/index.html?mediaId=15951931',
39 'only_matching': True,
41 'url': 'http://mais.uol.com.br/view/15954259',
42 'only_matching': True,
44 'url': 'http://noticias.band.uol.com.br/brasilurgente/video/2016/08/05/15951931/miss-simpatia-e-encontrada-morta.html',
45 'only_matching': True,
47 'url': 'http://videos.band.uol.com.br/programa.asp?e=noticias&pr=brasil-urgente&v=15951931&t=Policia-desmonte-base-do-PCC-na-Cracolandia',
48 'only_matching': True,
50 'url': 'http://mais.uol.com.br/view/cphaa0gl2x8r/incendio-destroi-uma-das-maiores-casas-noturnas-de-londres-04024E9A3268D4C95326',
51 'only_matching': True,
53 'url': 'http://noticias.uol.com.br//videos/assistir.htm?video=rafaela-silva-inspira-criancas-no-judo-04024D983968D4C95326',
54 'only_matching': True,
56 'url': 'http://mais.uol.com.br/view/e0qbgxid79uv/15275470',
57 'only_matching': True,
87 def _real_extract(self, url):
88 video_id = self._match_id(url)
89 if not video_id.isdigit():
90 embed_page = self._download_webpage('https://jsuol.com.br/c/tv/uol/embed/?params=[embed,%s]' % video_id, video_id)
91 video_id = self._search_regex(r'mediaId=(\d+)', embed_page, 'media id')
92 video_data = self._download_json(
93 'http://mais.uol.com.br/apiuol/v3/player/getMedia/%s.json' % video_id,
95 title = video_data['title']
98 'ver': video_data.get('numRevision', 2),
99 'r': 'http://mais.uol.com.br',
102 for f in video_data.get('formats', []):
103 f_url = f.get('url') or f.get('secureUrl')
106 format_id = str_or_none(f.get('id'))
108 'format_id': format_id,
109 'url': update_url_query(f_url, query),
111 fmt.update(self._FORMATS.get(format_id, {}))
113 self._sort_formats(formats)
116 for tag in video_data.get('tags', []):
117 tag_description = tag.get('description')
118 if not tag_description:
120 tags.append(tag_description)
125 'description': clean_html(video_data.get('desMedia')),
126 'thumbnail': video_data.get('thumbnail'),
127 'duration': int_or_none(video_data.get('durationSeconds')) or parse_duration(video_data.get('duration')),