]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tutv.py
4 from .common
import InfoExtractor
9 class TutvIE(InfoExtractor
):
10 _VALID_URL
=r
'https?://(?:www\.)?tu\.tv/videos/(?P<id>[^/?]+)'
12 u
'url': u
'http://tu.tv/videos/noah-en-pabellon-cuahutemoc',
13 u
'file': u
'2742556.flv',
14 u
'md5': u
'5eb766671f69b82e528dc1e7769c5cb2',
16 u
"title": u
"Noah en pabellon cuahutemoc"
20 def _real_extract(self
, url
):
21 mobj
= re
.match(self
._VALID
_URL
, url
)
22 video_id
= mobj
.group('id')
24 webpage
= self
._download
_webpage
(url
, video_id
)
25 internal_id
= self
._search
_regex
(r
'codVideo=([0-9]+)', webpage
, u
'internal video ID')
27 data_url
= u
'http://tu.tv/flvurl.php?codVideo=' + str(internal_id
)
28 data_content
= self
._download
_webpage
(data_url
, video_id
, note
=u
'Downloading video info')
29 data
= compat_parse_qs(data_content
)
30 video_url
= base64
.b64decode(data
['kpt'][0]).decode('utf-8')
31 ext
= video_url
.partition(u
'?')[0].rpartition(u
'.')[2]
37 'title': self
._og
_search
_title
(webpage
),