2 from __future__ import unicode_literals
6 from .common import InfoExtractor
7 from .kaltura import KalturaIE
15 class AsianCrushIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:www\.)?asiancrush\.com/video/(?:[^/]+/)?0+(?P<id>\d+)v\b'
18 'url': 'https://www.asiancrush.com/video/012869v/women-who-flirt/',
19 'md5': 'c3b740e48d0ba002a42c0b72857beae6',
23 'title': 'Women Who Flirt',
24 'description': 'md5:3db14e9186197857e7063522cb89a805',
25 'timestamp': 1496936429,
26 'upload_date': '20170608',
27 'uploader_id': 'craig@crifkin.com',
30 'url': 'https://www.asiancrush.com/video/she-was-pretty/011886v-pretty-episode-3/',
31 'only_matching': True,
34 def _real_extract(self, url):
35 video_id = self._match_id(url)
37 data = self._download_json(
38 'https://www.asiancrush.com/wp-admin/admin-ajax.php', video_id,
39 data=urlencode_postdata({
41 'action': 'get_channel_kaltura_vars',
44 entry_id = data['entry_id']
46 return self.url_result(
47 'kaltura:%s:%s' % (data['partner_id'], entry_id),
48 ie=KalturaIE.ie_key(), video_id=entry_id,
49 video_title=data.get('vid_label'))
52 class AsianCrushPlaylistIE(InfoExtractor):
53 _VALID_URL = r'https?://(?:www\.)?asiancrush\.com/series/0+(?P<id>\d+)s\b'
55 'url': 'https://www.asiancrush.com/series/012481s/scholar-walks-night/',
58 'title': 'Scholar Who Walks the Night',
59 'description': 'md5:7addd7c5132a09fd4741152d96cce886',
64 def _real_extract(self, url):
65 playlist_id = self._match_id(url)
67 webpage = self._download_webpage(url, playlist_id)
71 for mobj in re.finditer(
72 r'<a[^>]+href=(["\'])(?P<url>%s.*?)\1[^>]*>' % AsianCrushIE._VALID_URL,
74 attrs = extract_attributes(mobj.group(0))
75 if attrs.get('class') == 'clearfix':
76 entries.append(self.url_result(
77 mobj.group('url'), ie=AsianCrushIE.ie_key()))
80 self._html_search_regex(
81 r'(?s)<h1\b[^>]\bid=["\']movieTitle[^>]+>(.+?)</h1>', webpage,
82 'title', default=None) or self._og_search_title(
83 webpage, default=None) or self._html_search_meta(
84 'twitter:title', webpage, 'title',
85 default=None) or self._search_regex(
86 r'<title>([^<]+)</title>', webpage, 'title', fatal=False),
89 description = self._og_search_description(
90 webpage, default=None) or self._html_search_meta(
91 'twitter:description', webpage, 'description', fatal=False)
93 return self.playlist_result(entries, playlist_id, title, description)