mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[asiancrush] Fix extraction (closes #15630)
This commit is contained in:
parent
db348e8849
commit
0f2aa0dcaa
1 changed files with 31 additions and 11 deletions
|
@ -8,7 +8,6 @@
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
remove_end,
|
remove_end,
|
||||||
urlencode_postdata,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,19 +33,40 @@ class AsianCrushIE(InfoExtractor):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
data = self._download_json(
|
webpage = self._download_webpage(url, video_id)
|
||||||
'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']
|
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.asiancrush.com/embeddedVideoPlayer', 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')
|
||||||
|
|
||||||
return self.url_result(
|
return self.url_result(
|
||||||
'kaltura:%s:%s' % (data['partner_id'], entry_id),
|
'kaltura:%s:%s' % (partner_id, kaltura_id),
|
||||||
ie=KalturaIE.ie_key(), video_id=entry_id,
|
ie=KalturaIE.ie_key(), video_id=kaltura_id,
|
||||||
video_title=data.get('vid_label'))
|
video_title=title)
|
||||||
|
|
||||||
|
|
||||||
class AsianCrushPlaylistIE(InfoExtractor):
|
class AsianCrushPlaylistIE(InfoExtractor):
|
||||||
|
|
Loading…
Reference in a new issue