1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
8 _md5
= lambda s
: hashlib
.md5(s
.encode('utf-8')).hexdigest()
11 class KankanIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:.*?\.)?kankan\.com/.+?/(?P<id>\d+)\.shtml'
15 'url': 'http://yinyue.kankan.com/vod/48/48863.shtml',
16 'md5': '29aca1e47ae68fc28804aca89f29507e',
20 'title': 'Ready To Go',
22 'skip': 'Only available from China',
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
27 webpage
= self
._download
_webpage
(url
, video_id
)
29 title
= self
._search
_regex
(r
'(?:G_TITLE=|G_MOVIE_TITLE = )[\'"](.+?)[\'"]', webpage, 'video title
')
30 surls = re.search(r'surls
:\
[\'.+?
\'\
]|lurl
:\'.+?\
.flv
\'', webpage).group(0)
31 gcids = re.findall(r'http
://.+?
/.+?
/(.+?
)/', surls)
34 info_url = 'http
://p2s
.cl
.kankan
.com
/getCdnresource_flv?gcid
=%s' % gcid
35 video_info_page = self._download_webpage(
36 info_url, video_id, 'Downloading video url info
')
37 ip = self._search_regex(r'ip
:"(.+?)"', video_info_page, 'video url ip
')
38 path = self._search_regex(r'path
:"(.+?)"', video_info_page, 'video url path
')
39 param1 = self._search_regex(r'param1
:(\d
+)', video_info_page, 'param1
')
40 param2 = self._search_regex(r'param2
:(\d
+)', video_info_page, 'param2
')
41 key = _md5('xl_mp43651
' + param1 + param2)
42 video_url = 'http
://%s%s?key
=%s&key1
=%s' % (ip, path, key, param2)