- video_id = self._match_id(url)
-
- data = self._download_json(
- 'https://www.asiancrush.com/wp-admin/admin-ajax.php', video_id,
- data=urlencode_postdata({
- 'postid': video_id,
- 'action': 'get_channel_kaltura_vars',
- }))
-
- entry_id = data['entry_id']
-
- return self.url_result(
- 'kaltura:%s:%s' % (data['partner_id'], entry_id),
- ie=KalturaIE.ie_key(), video_id=entry_id,
- video_title=data.get('vid_label'))
+ mobj = re.match(self._VALID_URL, url)
+ host = mobj.group('host')
+ video_id = mobj.group('id')
+
+ webpage = self._download_webpage(url, video_id)
+
+ entry_id, partner_id, title = [None] * 3
+
+ vars = self._parse_json(
+ self._search_regex(
+ r'iEmbedVars\s*=\s*({.+?})', webpage, 'embed vars',
+ default='{}'), video_id, fatal=False)
+ if vars:
+ entry_id = vars.get('entry_id')
+ partner_id = vars.get('partner_id')
+ title = vars.get('vid_label')
+
+ if not entry_id:
+ entry_id = self._search_regex(
+ r'\bentry_id["\']\s*:\s*["\'](\d+)', webpage, 'entry id')
+
+ player = self._download_webpage(
+ 'https://api.%s/embeddedVideoPlayer' % host, video_id,
+ query={'id': entry_id})
+
+ kaltura_id = self._search_regex(
+ r'entry_id["\']\s*:\s*(["\'])(?P<id>(?:(?!\1).)+)\1', player,
+ 'kaltura id', group='id')
+
+ if not partner_id:
+ partner_id = self._search_regex(
+ r'/p(?:artner_id)?/(\d+)', player, 'partner id',
+ default='513551')
+
+ description = self._html_search_regex(
+ r'(?s)<div[^>]+\bclass=["\']description["\'][^>]*>(.+?)</div>',
+ webpage, 'description', fatal=False)
+
+ return {
+ '_type': 'url_transparent',
+ 'url': 'kaltura:%s:%s' % (partner_id, kaltura_id),
+ 'ie_key': KalturaIE.ie_key(),
+ 'id': video_id,
+ 'title': title,
+ 'description': description,
+ }