]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/kankan.py
3 from .common
import InfoExtractor
4 from ..utils
import determine_ext
7 class KankanIE(InfoExtractor
):
8 _VALID_URL
= r
'https?://(?:.*?\.)?kankan\.com/.+?/(?P<id>\d+)\.shtml'
11 u
'url': u
'http://yinyue.kankan.com/vod/48/48863.shtml',
12 u
'file': u
'48863.flv',
13 u
'md5': u
'29aca1e47ae68fc28804aca89f29507e',
15 u
'title': u
'Ready To Go',
19 def _real_extract(self
, url
):
20 mobj
= re
.match(self
._VALID
_URL
, url
)
21 video_id
= mobj
.group('id')
22 webpage
= self
._download
_webpage
(url
, video_id
)
24 title
= self
._search
_regex
(r
'G_TITLE=[\'"](.+?)[\'"]', webpage, u'video title
')
25 gcid = self._search_regex(r'lurl
:[\'"]http://.+?/.+?/(.+?)/', webpage, u'gcid')
27 video_info_page = self._download_webpage('http://p2s.cl.kankan.com/getCdnresource_flv?gcid=%s' % gcid,
28 video_id, u'Downloading video url info')
29 ip = self._search_regex(r'ip:"(.+?
)"', video_info_page, u'video url ip')
30 path = self._search_regex(r'path:"(.+?
)"', video_info_page, u'video url path')
31 video_url = 'http://%s%s' % (ip, path)
33 return {'id': video_id,
36 'ext': determine_ext(video_url),