]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tutv.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
11 class TutvIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?tu\.tv/videos/(?P<id>[^/?]+)'
14 'url': 'http://tu.tv/videos/noah-en-pabellon-cuahutemoc',
15 'file': '2742556.flv',
16 'md5': '5eb766671f69b82e528dc1e7769c5cb2',
18 'title': 'Noah en pabellon cuahutemoc',
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_url
= 'http://tu.tv/flvurl.php?codVideo=' + str(internal_id
)
30 data_content
= self
._download
_webpage
(data_url
, video_id
, note
='Downloading video info')
31 data
= compat_parse_qs(data_content
)
32 video_url
= base64
.b64decode(data
['kpt'][0]).decode('utf-8')
37 'title': self
._og
_search
_title
(webpage
),