2014-12-26 16:17:35 +01:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2018-05-30 15:14:51 +02:00
|
|
|
import re
|
|
|
|
|
2014-12-26 16:17:35 +01:00
|
|
|
from .common import InfoExtractor
|
2014-12-27 00:08:04 +06:00
|
|
|
from ..utils import (
|
|
|
|
parse_iso8601,
|
|
|
|
parse_duration,
|
|
|
|
parse_filesize,
|
|
|
|
int_or_none,
|
2018-05-30 15:14:51 +02:00
|
|
|
js_to_json,
|
2014-12-27 00:08:04 +06:00
|
|
|
)
|
|
|
|
|
2014-12-26 16:17:35 +01:00
|
|
|
|
|
|
|
class AlphaPornoIE(InfoExtractor):
|
2014-12-27 00:08:04 +06:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?alphaporno\.com/videos/(?P<id>[^/]+)'
|
2014-12-26 16:17:35 +01:00
|
|
|
_TEST = {
|
|
|
|
'url': 'http://www.alphaporno.com/videos/sensual-striptease-porn-with-samantha-alexandra/',
|
|
|
|
'md5': 'feb6d3bba8848cd54467a87ad34bd38e',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '258807',
|
2014-12-27 00:08:04 +06:00
|
|
|
'display_id': 'sensual-striptease-porn-with-samantha-alexandra',
|
2014-12-26 16:17:35 +01:00
|
|
|
'ext': 'mp4',
|
2014-12-27 00:08:04 +06:00
|
|
|
'title': 'Sensual striptease porn with Samantha Alexandra',
|
2017-01-02 20:08:07 +08:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2014-12-27 00:08:04 +06:00
|
|
|
'timestamp': 1418694611,
|
|
|
|
'upload_date': '20141216',
|
|
|
|
'duration': 387,
|
|
|
|
'filesize_approx': 54120000,
|
|
|
|
'tbr': 1145,
|
|
|
|
'categories': list,
|
2014-12-26 16:17:35 +01:00
|
|
|
'age_limit': 18,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2014-12-27 00:08:04 +06:00
|
|
|
display_id = self._match_id(url)
|
2014-12-26 16:17:35 +01:00
|
|
|
|
2014-12-27 00:08:04 +06:00
|
|
|
webpage = self._download_webpage(url, display_id)
|
2014-12-26 16:17:35 +01:00
|
|
|
|
2018-05-30 15:14:51 +02:00
|
|
|
video_id = re.sub(r'^https?://.*/embed/', '', self._html_search_meta('embedUrl', webpage, 'video id'))
|
|
|
|
|
2018-06-04 14:57:08 +02:00
|
|
|
result = self._extract_jwplayer_data(webpage, video_id, require_title=False)
|
2014-12-26 16:17:35 +01:00
|
|
|
|
2014-12-27 00:08:04 +06:00
|
|
|
title = self._search_regex(
|
|
|
|
[r'<meta content="([^"]+)" itemprop="description">',
|
|
|
|
r'class="title" itemprop="name">([^<]+)<'],
|
|
|
|
webpage, 'title')
|
|
|
|
timestamp = parse_iso8601(self._html_search_meta(
|
|
|
|
'uploadDate', webpage, 'upload date'))
|
|
|
|
duration = parse_duration(self._html_search_meta(
|
|
|
|
'duration', webpage, 'duration'))
|
2018-06-04 14:57:08 +02:00
|
|
|
filesize_approx = self._html_search_meta(
|
|
|
|
'contentSize', webpage, 'file size')
|
|
|
|
|
|
|
|
# bitrates are taken from the URL; the document only contains
|
|
|
|
# a single value for the lowest quality
|
|
|
|
for f in result.get('formats') or []:
|
|
|
|
m = re.search(r'[?&]br=(\d+)', f.get('url') or '')
|
|
|
|
if m:
|
|
|
|
f['tbr'] = int(m.group(1))
|
|
|
|
|
|
|
|
# filesizes are concatenated together in the meta tag
|
|
|
|
if filesize_approx:
|
|
|
|
filesizes = re.findall(r'\s*[\d.]+\s*[A-Za-z]+', filesize_approx)
|
|
|
|
for f, size in zip(result.get('formats') or [], filesizes):
|
|
|
|
f['filesize_approx'] = parse_filesize(size)
|
|
|
|
|
2014-12-27 00:08:04 +06:00
|
|
|
categories = self._html_search_meta(
|
|
|
|
'keywords', webpage, 'categories', default='').split(',')
|
2014-12-26 16:17:35 +01:00
|
|
|
|
2014-12-27 00:08:04 +06:00
|
|
|
age_limit = self._rta_search(webpage)
|
2014-12-26 16:17:35 +01:00
|
|
|
|
2018-06-04 14:57:08 +02:00
|
|
|
result.update({
|
2014-12-27 00:08:04 +06:00
|
|
|
'display_id': display_id,
|
|
|
|
'title': title,
|
|
|
|
'timestamp': timestamp,
|
|
|
|
'duration': duration,
|
2014-12-26 16:17:35 +01:00
|
|
|
'categories': categories,
|
2014-12-27 00:08:04 +06:00
|
|
|
'age_limit': age_limit,
|
2018-06-04 14:57:08 +02:00
|
|
|
})
|
|
|
|
return result
|