2022-10-12 01:39:28 -04:00
|
|
|
import re
|
|
|
|
|
2014-09-03 08:10:06 -04:00
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
2014-09-03 10:07:18 -04:00
|
|
|
fix_xml_ampersands,
|
2015-06-28 13:05:09 -04:00
|
|
|
float_or_none,
|
|
|
|
int_or_none,
|
|
|
|
parse_duration,
|
|
|
|
str_to_int,
|
2016-08-25 18:57:52 -04:00
|
|
|
unescapeHTML,
|
2022-10-12 01:39:28 -04:00
|
|
|
url_basename,
|
2015-06-28 13:05:09 -04:00
|
|
|
xpath_text,
|
2014-09-03 08:10:06 -04:00
|
|
|
)
|
|
|
|
|
2014-09-03 10:07:18 -04:00
|
|
|
|
2015-06-28 13:05:09 -04:00
|
|
|
class TNAFlixNetworkBaseIE(InfoExtractor):
|
|
|
|
# May be overridden in descendants if necessary
|
|
|
|
_CONFIG_REGEX = [
|
2018-11-16 10:55:35 -05:00
|
|
|
r'flashvars\.config\s*=\s*escape\("(?P<url>[^"]+)"',
|
|
|
|
r'<input[^>]+name="config\d?" value="(?P<url>[^"]+)"',
|
|
|
|
r'config\s*=\s*(["\'])(?P<url>(?:https?:)?//(?:(?!\1).)+)\1',
|
2015-05-22 03:29:35 -04:00
|
|
|
]
|
2015-06-28 13:05:09 -04:00
|
|
|
_TITLE_REGEX = r'<input[^>]+name="title" value="([^"]+)"'
|
|
|
|
_DESCRIPTION_REGEX = r'<input[^>]+name="description" value="([^"]+)"'
|
|
|
|
_UPLOADER_REGEX = r'<input[^>]+name="username" value="([^"]+)"'
|
|
|
|
_VIEW_COUNT_REGEX = None
|
|
|
|
_COMMENT_COUNT_REGEX = None
|
|
|
|
_AVERAGE_RATING_REGEX = None
|
|
|
|
_CATEGORIES_REGEX = r'<li[^>]*>\s*<span[^>]+class="infoTitle"[^>]*>Categories:</span>\s*<span[^>]+class="listView"[^>]*>(.+?)</span>\s*</li>'
|
|
|
|
|
|
|
|
def _extract_thumbnails(self, flix_xml):
|
|
|
|
|
|
|
|
def get_child(elem, names):
|
|
|
|
for name in names:
|
|
|
|
child = elem.find(name)
|
|
|
|
if child is not None:
|
|
|
|
return child
|
|
|
|
|
|
|
|
timeline = get_child(flix_xml, ['timeline', 'rolloverBarImage'])
|
|
|
|
if timeline is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
pattern_el = get_child(timeline, ['imagePattern', 'pattern'])
|
|
|
|
if pattern_el is None or not pattern_el.text:
|
|
|
|
return
|
|
|
|
|
|
|
|
first_el = get_child(timeline, ['imageFirst', 'first'])
|
|
|
|
last_el = get_child(timeline, ['imageLast', 'last'])
|
|
|
|
if first_el is None or last_el is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
first_text = first_el.text
|
|
|
|
last_text = last_el.text
|
|
|
|
if not first_text.isdigit() or not last_text.isdigit():
|
|
|
|
return
|
|
|
|
|
|
|
|
first = int(first_text)
|
|
|
|
last = int(last_text)
|
|
|
|
if first > last:
|
|
|
|
return
|
|
|
|
|
|
|
|
width = int_or_none(xpath_text(timeline, './imageWidth', 'thumbnail width'))
|
|
|
|
height = int_or_none(xpath_text(timeline, './imageHeight', 'thumbnail height'))
|
|
|
|
|
|
|
|
return [{
|
2024-06-11 19:09:58 -04:00
|
|
|
'url': self._proto_relative_url(pattern_el.text.replace('#', str(i)), 'http:'),
|
2015-06-28 13:05:09 -04:00
|
|
|
'width': width,
|
|
|
|
'height': height,
|
|
|
|
} for i in range(first, last + 1)]
|
2014-09-03 08:10:06 -04:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2021-08-18 21:41:24 -04:00
|
|
|
mobj = self._match_valid_url(url)
|
2022-10-12 01:39:28 -04:00
|
|
|
video_id, host = mobj.group('id', 'host')
|
2017-11-25 11:22:54 -05:00
|
|
|
for display_id_key in ('display_id', 'display_id_2'):
|
|
|
|
if display_id_key in mobj.groupdict():
|
|
|
|
display_id = mobj.group(display_id_key)
|
|
|
|
if display_id:
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
display_id = video_id
|
2014-09-03 08:10:06 -04:00
|
|
|
|
|
|
|
webpage = self._download_webpage(url, display_id)
|
2023-02-11 23:21:29 -05:00
|
|
|
inputs = self._hidden_inputs(webpage)
|
|
|
|
query = {}
|
2014-09-03 08:10:06 -04:00
|
|
|
|
2022-10-12 01:39:28 -04:00
|
|
|
# check for MovieFap-style config
|
2014-12-31 13:12:41 -05:00
|
|
|
cfg_url = self._proto_relative_url(self._html_search_regex(
|
2018-11-16 10:55:35 -05:00
|
|
|
self._CONFIG_REGEX, webpage, 'flashvars.config', default=None,
|
|
|
|
group='url'), 'http:')
|
2016-04-08 13:34:59 -04:00
|
|
|
|
|
|
|
if not cfg_url:
|
2023-02-11 23:21:29 -05:00
|
|
|
cfg_url = inputs.get('config')
|
|
|
|
|
|
|
|
# check for TNAFlix-style config
|
|
|
|
if not cfg_url and inputs.get('vkey') and inputs.get('nkey'):
|
|
|
|
cfg_url = f'http://cdn-fck.{host}.com/{host}/{inputs["vkey"]}.fid'
|
|
|
|
query.update({
|
|
|
|
'key': inputs['nkey'],
|
|
|
|
'VID': video_id,
|
|
|
|
'premium': '1',
|
|
|
|
'vip': '1',
|
|
|
|
'alpha': '',
|
|
|
|
})
|
2022-10-12 01:39:28 -04:00
|
|
|
|
|
|
|
formats, json_ld = [], {}
|
|
|
|
|
|
|
|
# TNAFlix and MovieFap extraction
|
|
|
|
if cfg_url:
|
|
|
|
cfg_xml = self._download_xml(
|
|
|
|
cfg_url, display_id, 'Downloading metadata',
|
|
|
|
transform_source=fix_xml_ampersands, headers={'Referer': url}, query=query)
|
|
|
|
|
|
|
|
def extract_video_url(vl):
|
|
|
|
# Any URL modification now results in HTTP Error 403: Forbidden
|
|
|
|
return unescapeHTML(vl.text)
|
|
|
|
|
|
|
|
video_link = cfg_xml.find('./videoLink')
|
|
|
|
if video_link is not None:
|
|
|
|
formats.append({
|
|
|
|
'url': extract_video_url(video_link),
|
|
|
|
'ext': xpath_text(cfg_xml, './videoConfig/type', 'type', default='flv'),
|
|
|
|
})
|
|
|
|
|
|
|
|
for item in cfg_xml.findall('./quality/item'):
|
|
|
|
video_link = item.find('./videoLink')
|
|
|
|
if video_link is None:
|
|
|
|
continue
|
|
|
|
res = item.find('res')
|
|
|
|
format_id = None if res is None else res.text
|
|
|
|
height = int_or_none(self._search_regex(
|
|
|
|
r'^(\d+)[pP]', format_id, 'height', default=None))
|
|
|
|
formats.append({
|
|
|
|
'url': self._proto_relative_url(extract_video_url(video_link), 'http:'),
|
|
|
|
'format_id': format_id,
|
|
|
|
'height': height,
|
|
|
|
})
|
|
|
|
|
|
|
|
thumbnails = self._extract_thumbnails(cfg_xml) or []
|
|
|
|
thumbnails.append({
|
2024-06-11 19:09:58 -04:00
|
|
|
'url': self._proto_relative_url(xpath_text(cfg_xml, './startThumb', 'thumbnail'), 'http:'),
|
2015-06-28 13:05:09 -04:00
|
|
|
})
|
|
|
|
|
2022-10-12 01:39:28 -04:00
|
|
|
# check for EMPFlix-style JSON and extract
|
|
|
|
else:
|
|
|
|
player = self._download_json(
|
|
|
|
f'http://www.{host}.com/ajax/video-player/{video_id}', video_id,
|
|
|
|
headers={'Referer': url}).get('html', '')
|
|
|
|
for mobj in re.finditer(r'<source src="(?P<src>[^"]+)"', player):
|
|
|
|
video_url = mobj.group('src')
|
|
|
|
height = self._search_regex(r'-(\d+)p\.', url_basename(video_url), 'height', default=None)
|
|
|
|
formats.append({
|
|
|
|
'url': self._proto_relative_url(video_url, 'http:'),
|
|
|
|
'ext': url_basename(video_url).split('.')[-1],
|
|
|
|
'height': int_or_none(height),
|
|
|
|
'format_id': f'{height}p' if height else url_basename(video_url).split('.')[0],
|
|
|
|
})
|
|
|
|
thumbnail = self._proto_relative_url(self._search_regex(
|
|
|
|
r'data-poster="([^"]+)"', player, 'thumbnail', default=None), 'http:')
|
|
|
|
thumbnails = [{'url': thumbnail}] if thumbnail else None
|
|
|
|
json_ld = self._search_json_ld(webpage, display_id, default={})
|
2015-06-28 13:05:09 -04:00
|
|
|
|
2022-10-12 01:39:28 -04:00
|
|
|
def extract_field(pattern, name):
|
|
|
|
return self._html_search_regex(pattern, webpage, name, default=None) if pattern else None
|
2015-06-28 13:05:09 -04:00
|
|
|
|
2014-09-03 08:10:06 -04:00
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'display_id': display_id,
|
2022-10-12 01:39:28 -04:00
|
|
|
'title': (extract_field(self._TITLE_REGEX, 'title')
|
|
|
|
or self._og_search_title(webpage, default=None)
|
|
|
|
or json_ld.get('title')),
|
|
|
|
'description': extract_field(self._DESCRIPTION_REGEX, 'description') or json_ld.get('description'),
|
2015-06-28 13:05:09 -04:00
|
|
|
'thumbnails': thumbnails,
|
2022-10-12 01:39:28 -04:00
|
|
|
'duration': parse_duration(
|
|
|
|
self._html_search_meta('duration', webpage, 'duration', default=None)) or json_ld.get('duration'),
|
|
|
|
'age_limit': self._rta_search(webpage) or 18,
|
|
|
|
'uploader': extract_field(self._UPLOADER_REGEX, 'uploader') or json_ld.get('uploader'),
|
|
|
|
'view_count': str_to_int(extract_field(self._VIEW_COUNT_REGEX, 'view count')),
|
|
|
|
'comment_count': str_to_int(extract_field(self._COMMENT_COUNT_REGEX, 'comment count')),
|
|
|
|
'average_rating': float_or_none(extract_field(self._AVERAGE_RATING_REGEX, 'average rating')),
|
|
|
|
'categories': list(map(str.strip, (extract_field(self._CATEGORIES_REGEX, 'categories') or '').split(','))),
|
2014-09-03 10:07:18 -04:00
|
|
|
'formats': formats,
|
2014-09-03 08:10:06 -04:00
|
|
|
}
|
2015-06-28 13:05:09 -04:00
|
|
|
|
|
|
|
|
2016-02-27 05:58:11 -05:00
|
|
|
class TNAFlixNetworkEmbedIE(TNAFlixNetworkBaseIE):
|
2022-10-12 01:39:28 -04:00
|
|
|
_VALID_URL = r'https?://player\.(?P<host>tnaflix|empflix)\.com/video/(?P<id>\d+)'
|
2022-07-31 21:23:25 -04:00
|
|
|
_EMBED_REGEX = [r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//player\.(?:tna|emp)flix\.com/video/\d+)\1']
|
2016-02-27 05:58:11 -05:00
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://player.tnaflix.com/video/6538',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '6538',
|
|
|
|
'display_id': '6538',
|
|
|
|
'ext': 'mp4',
|
2022-10-12 01:39:28 -04:00
|
|
|
'title': 'Educational xxx video (G Spot)',
|
|
|
|
'description': 'md5:b4fab8f88a8621c8fabd361a173fe5b8',
|
2017-01-02 07:08:07 -05:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2016-02-27 05:58:11 -05:00
|
|
|
'age_limit': 18,
|
2022-10-12 01:39:28 -04:00
|
|
|
'duration': 164,
|
|
|
|
'uploader': 'bobwhite39',
|
|
|
|
'categories': list,
|
2016-02-27 05:58:11 -05:00
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
}, {
|
2022-10-12 01:39:28 -04:00
|
|
|
'url': 'http://player.empflix.com/video/33051',
|
2016-02-27 05:58:11 -05:00
|
|
|
'only_matching': True,
|
|
|
|
}]
|
|
|
|
|
2022-10-12 01:39:28 -04:00
|
|
|
def _real_extract(self, url):
|
|
|
|
mobj = self._match_valid_url(url)
|
|
|
|
video_id, host = mobj.group('id', 'host')
|
|
|
|
return self.url_result(f'http://www.{host}.com/category/{video_id}/video{video_id}')
|
|
|
|
|
2016-02-27 05:58:11 -05:00
|
|
|
|
2017-11-25 11:37:50 -05:00
|
|
|
class TNAEMPFlixBaseIE(TNAFlixNetworkBaseIE):
|
|
|
|
_DESCRIPTION_REGEX = r'(?s)>Description:</[^>]+>(.+?)<'
|
|
|
|
_UPLOADER_REGEX = r'<span>by\s*<a[^>]+\bhref=["\']/profile/[^>]+>([^<]+)<'
|
|
|
|
_CATEGORIES_REGEX = r'(?s)<span[^>]*>Categories:</span>(.+?)</div>'
|
|
|
|
|
|
|
|
|
|
|
|
class TNAFlixIE(TNAEMPFlixBaseIE):
|
2022-10-12 01:39:28 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?(?P<host>tnaflix)\.com/[^/]+/(?P<display_id>[^/]+)/video(?P<id>\d+)'
|
2015-06-28 13:05:09 -04:00
|
|
|
|
2016-08-07 04:57:42 -04:00
|
|
|
_TITLE_REGEX = r'<title>(.+?) - (?:TNAFlix Porn Videos|TNAFlix\.com)</title>'
|
2015-06-28 13:05:09 -04:00
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
# anonymous uploader, no categories
|
|
|
|
'url': 'http://www.tnaflix.com/porn-stars/Carmella-Decesare-striptease/video553878',
|
2017-11-25 11:37:50 -05:00
|
|
|
'md5': '7e569419fe6d69543d01e6be22f5f7c4',
|
2015-06-28 13:05:09 -04:00
|
|
|
'info_dict': {
|
|
|
|
'id': '553878',
|
|
|
|
'display_id': 'Carmella-Decesare-striptease',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Carmella Decesare - striptease',
|
2017-01-02 07:08:07 -05:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2015-06-28 13:05:09 -04:00
|
|
|
'duration': 91,
|
|
|
|
'age_limit': 18,
|
2022-10-12 01:39:28 -04:00
|
|
|
'categories': list,
|
2024-06-11 19:09:58 -04:00
|
|
|
},
|
2015-06-28 13:05:09 -04:00
|
|
|
}, {
|
|
|
|
# non-anonymous uploader, categories
|
|
|
|
'url': 'https://www.tnaflix.com/teen-porn/Educational-xxx-video/video6538',
|
2022-10-12 01:39:28 -04:00
|
|
|
'md5': 'add5a9fa7f4da53d3e9d0845ac58f20c',
|
2015-06-28 13:05:09 -04:00
|
|
|
'info_dict': {
|
|
|
|
'id': '6538',
|
|
|
|
'display_id': 'Educational-xxx-video',
|
2016-08-25 18:57:52 -04:00
|
|
|
'ext': 'mp4',
|
2022-10-12 01:39:28 -04:00
|
|
|
'title': 'Educational xxx video (G Spot)',
|
2015-06-28 13:05:09 -04:00
|
|
|
'description': 'md5:b4fab8f88a8621c8fabd361a173fe5b8',
|
2017-01-02 07:08:07 -05:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2015-06-28 13:05:09 -04:00
|
|
|
'duration': 164,
|
|
|
|
'age_limit': 18,
|
|
|
|
'uploader': 'bobwhite39',
|
2017-11-25 11:37:50 -05:00
|
|
|
'categories': list,
|
2024-06-11 19:09:58 -04:00
|
|
|
},
|
2015-06-28 13:05:09 -04:00
|
|
|
}, {
|
|
|
|
'url': 'https://www.tnaflix.com/amateur-porn/bunzHD-Ms.Donk/video358632',
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
2017-11-25 11:37:50 -05:00
|
|
|
class EMPFlixIE(TNAEMPFlixBaseIE):
|
2022-10-12 01:39:28 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?(?P<host>empflix)\.com/(?:videos/(?P<display_id>.+?)-|[^/]+/(?P<display_id_2>[^/]+)/video)(?P<id>[0-9]+)'
|
2015-06-28 13:05:09 -04:00
|
|
|
|
|
|
|
_TESTS = [{
|
2022-10-12 01:39:28 -04:00
|
|
|
'url': 'http://www.empflix.com/amateur-porn/Amateur-Finger-Fuck/video33051',
|
|
|
|
'md5': 'd761c7b26601bd14476cd9512f2654fc',
|
2015-06-28 13:05:09 -04:00
|
|
|
'info_dict': {
|
|
|
|
'id': '33051',
|
|
|
|
'display_id': 'Amateur-Finger-Fuck',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Amateur Finger Fuck',
|
|
|
|
'description': 'Amateur solo finger fucking.',
|
2017-01-02 07:08:07 -05:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2015-06-28 13:05:09 -04:00
|
|
|
'duration': 83,
|
|
|
|
'age_limit': 18,
|
2022-10-12 01:39:28 -04:00
|
|
|
'categories': list,
|
2024-06-11 19:09:58 -04:00
|
|
|
},
|
2015-06-28 13:05:09 -04:00
|
|
|
}, {
|
|
|
|
'url': 'http://www.empflix.com/videos/[AROMA][ARMD-718]-Aoi-Yoshino-Sawa-25826.html',
|
|
|
|
'only_matching': True,
|
2017-11-25 11:22:54 -05:00
|
|
|
}, {
|
2022-10-12 01:39:28 -04:00
|
|
|
'url': 'http://www.empflix.com/videos/Amateur-Finger-Fuck-33051.html',
|
2017-11-25 11:22:54 -05:00
|
|
|
'only_matching': True,
|
2015-06-28 13:05:09 -04:00
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
class MovieFapIE(TNAFlixNetworkBaseIE):
|
2022-10-12 01:39:28 -04:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?(?P<host>moviefap)\.com/videos/(?P<id>[0-9a-f]+)/(?P<display_id>[^/]+)\.html'
|
2015-06-28 13:05:09 -04:00
|
|
|
|
|
|
|
_VIEW_COUNT_REGEX = r'<br>Views\s*<strong>([\d,.]+)</strong>'
|
|
|
|
_COMMENT_COUNT_REGEX = r'<span[^>]+id="comCount"[^>]*>([\d,.]+)</span>'
|
|
|
|
_AVERAGE_RATING_REGEX = r'Current Rating\s*<br>\s*<strong>([\d.]+)</strong>'
|
|
|
|
_CATEGORIES_REGEX = r'(?s)<div[^>]+id="vid_info"[^>]*>\s*<div[^>]*>.+?</div>(.*?)<br>'
|
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
# normal, multi-format video
|
|
|
|
'url': 'http://www.moviefap.com/videos/be9867c9416c19f54a4a/experienced-milf-amazing-handjob.html',
|
|
|
|
'md5': '26624b4e2523051b550067d547615906',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'be9867c9416c19f54a4a',
|
|
|
|
'display_id': 'experienced-milf-amazing-handjob',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Experienced MILF Amazing Handjob',
|
|
|
|
'description': 'Experienced MILF giving an Amazing Handjob',
|
2017-01-02 07:08:07 -05:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2015-06-28 13:05:09 -04:00
|
|
|
'age_limit': 18,
|
|
|
|
'uploader': 'darvinfred06',
|
|
|
|
'view_count': int,
|
|
|
|
'comment_count': int,
|
|
|
|
'average_rating': float,
|
|
|
|
'categories': ['Amateur', 'Masturbation', 'Mature', 'Flashing'],
|
2024-06-11 19:09:58 -04:00
|
|
|
},
|
2015-06-28 13:05:09 -04:00
|
|
|
}, {
|
|
|
|
# quirky single-format case where the extension is given as fid, but the video is really an flv
|
|
|
|
'url': 'http://www.moviefap.com/videos/e5da0d3edce5404418f5/jeune-couple-russe.html',
|
|
|
|
'md5': 'fa56683e291fc80635907168a743c9ad',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'e5da0d3edce5404418f5',
|
|
|
|
'display_id': 'jeune-couple-russe',
|
|
|
|
'ext': 'flv',
|
|
|
|
'title': 'Jeune Couple Russe',
|
|
|
|
'description': 'Amateur',
|
2017-01-02 07:08:07 -05:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2015-06-28 13:05:09 -04:00
|
|
|
'age_limit': 18,
|
|
|
|
'uploader': 'whiskeyjar',
|
|
|
|
'view_count': int,
|
|
|
|
'comment_count': int,
|
|
|
|
'average_rating': float,
|
|
|
|
'categories': ['Amateur', 'Teen'],
|
2022-10-12 01:39:28 -04:00
|
|
|
},
|
|
|
|
'skip': 'This video does not exist',
|
2015-06-28 13:05:09 -04:00
|
|
|
}]
|