1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..compat import compat_parse_qs
9 class TutvIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?tu\.tv/videos/(?P<id>[^/?]+)'
12 'url': 'http://tu.tv/videos/robots-futbolistas',
13 'md5': '627c7c124ac2a9b5ab6addb94e0e65f7',
17 'title': 'Robots futbolistas',
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 webpage = self._download_webpage(url, video_id)
25 internal_id = self._search_regex(r'codVideo=([0-9]+)', webpage, 'internal video ID')
27 data_content = self._download_webpage(
28 'http://tu.tv/flvurl.php?codVideo=%s' % internal_id, video_id, 'Downloading video info')
29 video_url = base64.b64decode(compat_parse_qs(data_content)['kpt'][0].encode('utf-8')).decode('utf-8')
34 'title': self._og_search_title(webpage),