mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-09 21:47:17 +08:00
[asiancrush] improve coding conventions
This commit is contained in:
parent
8861b4b414
commit
5aaa26a9dc
@ -10,8 +10,7 @@ from ..utils import extract_attributes
|
|||||||
|
|
||||||
class AsianCrushIE(InfoExtractor):
|
class AsianCrushIE(InfoExtractor):
|
||||||
IE_NAME = 'asiancrush'
|
IE_NAME = 'asiancrush'
|
||||||
_DOMAINS = r'(?:asiancrush\.com|yuyutv\.com|midnightpulp\.com)'
|
_VALID_URL = r'https?://(?:www\.)?(?P<host>(?:asiancrush\.com|yuyutv\.com|midnightpulp\.com))/video/(?:[^/]+/)?0+(?P<id>\d+)v\b'
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?P<host>%s)/video/(?:[^/]+/)?0+(?P<id>\d+)v\b' % _DOMAINS
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.asiancrush.com/video/012869v/women-who-flirt/',
|
'url': 'https://www.asiancrush.com/video/012869v/women-who-flirt/',
|
||||||
'md5': 'c3b740e48d0ba002a42c0b72857beae6',
|
'md5': 'c3b740e48d0ba002a42c0b72857beae6',
|
||||||
@ -93,7 +92,8 @@ class AsianCrushIE(InfoExtractor):
|
|||||||
r'/p(?:artner_id)?/(\d+)', player, 'partner id',
|
r'/p(?:artner_id)?/(\d+)', player, 'partner id',
|
||||||
default='513551')
|
default='513551')
|
||||||
|
|
||||||
description = self._html_search_regex(r'<div class="description">(.+?)</div>', webpage, 'description', fatal=False, flags=re.DOTALL)
|
description = self._html_search_regex(
|
||||||
|
r'<div class="description">(.+?)</div>', webpage, 'description', fatal=False, flags=re.DOTALL)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
@ -106,9 +106,7 @@ class AsianCrushIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class AsianCrushPlaylistIE(InfoExtractor):
|
class AsianCrushPlaylistIE(InfoExtractor):
|
||||||
_VIDEO_IE = AsianCrushIE
|
_VALID_URL = r'https?://(?:www\.)?(?P<host>(?:asiancrush\.com|yuyutv\.com|midnightpulp\.com))/series/0+(?P<id>\d+)s\b'
|
||||||
_DOMAINS = r'(?:asiancrush\.com|yuyutv\.com|midnightpulp\.com)'
|
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?P<host>%s)/series/0+(?P<id>\d+)s\b' % _DOMAINS
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.asiancrush.com/series/012481s/scholar-walks-night/',
|
'url': 'https://www.asiancrush.com/series/012481s/scholar-walks-night/',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -143,22 +141,23 @@ class AsianCrushPlaylistIE(InfoExtractor):
|
|||||||
entries = []
|
entries = []
|
||||||
|
|
||||||
for mobj in re.finditer(
|
for mobj in re.finditer(
|
||||||
r'<a[^>]+href=(["\'])(?P<url>%s.*?)\1[^>]*>' % self._VIDEO_IE._VALID_URL,
|
r'<a[^>]+href=(["\'])(?P<url>%s.*?)\1[^>]*>' % AsianCrushIE._VALID_URL,
|
||||||
webpage):
|
webpage):
|
||||||
attrs = extract_attributes(mobj.group(0))
|
attrs = extract_attributes(mobj.group(0))
|
||||||
if attrs.get('class') == 'clearfix':
|
if attrs.get('class') == 'clearfix':
|
||||||
entries.append(self.url_result(
|
entries.append(self.url_result(
|
||||||
mobj.group('url'), ie=self._VIDEO_IE.ie_key()))
|
mobj.group('url'), ie=AsianCrushIE.ie_key()))
|
||||||
|
|
||||||
title = re.sub(r'\s*\|\s*.+?$', '',
|
title = re.sub(
|
||||||
self._html_search_regex(
|
r'\s*\|\s*.+?$', '',
|
||||||
r'(?s)<h1\b[^>]\bid=["\']movieTitle[^>]+>(.+?)</h1>', webpage,
|
self._html_search_regex(
|
||||||
'title', default=None) or self._og_search_title(
|
r'(?s)<h1\b[^>]\bid=["\']movieTitle[^>]+>(.+?)</h1>', webpage,
|
||||||
webpage, default=None) or self._html_search_meta(
|
'title', default=None) or self._og_search_title(
|
||||||
'twitter:title', webpage, 'title',
|
webpage, default=None) or self._html_search_meta(
|
||||||
default=None) or self._search_regex(
|
'twitter:title', webpage, 'title',
|
||||||
r'<title>([^<]+)</title>', webpage, 'title', fatal=False)
|
default=None) or self._search_regex(
|
||||||
)
|
r'<title>([^<]+)</title>', webpage, 'title', fatal=False)
|
||||||
|
)
|
||||||
|
|
||||||
description = self._og_search_description(
|
description = self._og_search_description(
|
||||||
webpage, default=None) or self._html_search_meta(
|
webpage, default=None) or self._html_search_meta(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user