1 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from ..utils import compat_parse_qs
10 class TutvIE(InfoExtractor):
11 _VALID_URL = r'https?://(?:www\.)?tu\.tv/videos/(?P<id>[^/?]+)'
13 'url': 'http://tu.tv/videos/robots-futbolistas',
14 'md5': '627c7c124ac2a9b5ab6addb94e0e65f7',
18 'title': 'Robots futbolistas',
22 def _real_extract(self, url):
23 mobj = re.match(self._VALID_URL, url)
24 video_id = mobj.group('id')
26 webpage = self._download_webpage(url, video_id)
27 internal_id = self._search_regex(r'codVideo=([0-9]+)', webpage, 'internal video ID')
29 data_content = self._download_webpage(
30 'http://tu.tv/flvurl.php?codVideo=%s' % internal_id, video_id, 'Downloading video info')
31 video_url = base64.b64decode(compat_parse_qs(data_content)['kpt'][0]).decode('utf-8')
36 'title': self._og_search_title(webpage),