]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/tutv.py
fcaa6ac01af6d778e43aa7b35d92d3dcc9478911
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 title
= self
._html
_search
_regex
(
26 r
'<meta property="og:title" content="(.*?)">', webpage
, u
'title')
27 internal_id
= self
._search
_regex
(r
'codVideo=([0-9]+)', webpage
, u
'internal video ID')
29 data_url
= u
'http://tu.tv/flvurl.php?codVideo=' + str(internal_id
)
30 data_content
= self
._download
_webpage
(data_url
, video_id
, note
=u
'Downloading video info')
31 data
= compat_parse_qs(data_content
)
32 video_url
= base64
.b64decode(data
['kpt'][0]).decode('utf-8')
33 ext
= video_url
.partition(u
'?')[0].rpartition(u
'.')[2]