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=|G_MOVIE_TITLE = )[\'"](.+?)[\'"]', webpage, u'video title')
25 surls = re.search(r'surls:\[\'.+?\'\]|lurl:\'.+?\.flv\'', webpage).group(0)
26 gcids = re.findall(r"http://.+?/.+?/(.+?)/", surls)
29 video_info_page = self._download_webpage('http://p2s.cl.kankan.com/getCdnresource_flv?gcid=%s' % gcid,
30 video_id, u'Downloading video url info')
31 ip = self._search_regex(r'ip:"(.+?)"', video_info_page, u'video url ip')
32 path = self._search_regex(r'path:"(.+?)"', video_info_page, u'video url path')
33 video_url = 'http://%s%s' % (ip, path)
35 return {'id': video_id,
38 'ext': determine_ext(video_url),