2014-11-13 04:41:13 +09:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2020-05-14 20:51:40 +09:00
|
|
|
import re
|
|
|
|
|
2014-11-13 04:41:13 +09:00
|
|
|
from .common import InfoExtractor
|
2020-05-14 20:51:40 +09:00
|
|
|
from ..utils import urlencode_postdata
|
2014-11-13 04:41:13 +09:00
|
|
|
|
|
|
|
|
|
|
|
class SexuIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?sexu\.com/(?P<id>\d+)'
|
|
|
|
_TEST = {
|
|
|
|
'url': 'http://sexu.com/961791/',
|
|
|
|
'md5': 'ff615aca9691053c94f8f10d96cd7884',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '961791',
|
|
|
|
'ext': 'mp4',
|
2014-11-13 22:02:53 +09:00
|
|
|
'title': 'md5:4d05a19a5fc049a63dbbaf05fb71d91b',
|
2020-05-14 20:51:40 +09:00
|
|
|
'description': 'md5:6c7e471f9ac9bc326a9ad27be409f617',
|
2014-11-13 04:41:13 +09:00
|
|
|
'categories': list, # NSFW
|
2017-01-02 21:08:07 +09:00
|
|
|
'thumbnail': r're:https?://.*\.jpg$',
|
2014-11-13 04:41:13 +09:00
|
|
|
'age_limit': 18,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2014-11-13 23:20:49 +09:00
|
|
|
video_id = self._match_id(url)
|
2014-11-13 04:41:13 +09:00
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
2020-05-14 20:51:40 +09:00
|
|
|
apiresponse = self._download_json(
|
|
|
|
'https://sexu.com/api/video-info',
|
|
|
|
video_id, data=urlencode_postdata({'videoId': video_id})
|
|
|
|
)
|
2014-11-13 04:41:13 +09:00
|
|
|
formats = [{
|
2020-05-14 20:51:40 +09:00
|
|
|
'url': source.get('src'),
|
|
|
|
'format_id': source.get('type'),
|
2017-06-09 02:30:23 +09:00
|
|
|
'height': int(self._search_regex(
|
2020-05-14 20:51:40 +09:00
|
|
|
r'^(\d+)[pP]', source.get('quality', ''), 'height',
|
2017-06-09 02:30:23 +09:00
|
|
|
default=None)),
|
2020-05-14 20:51:40 +09:00
|
|
|
} for source in apiresponse['sources']]
|
2014-11-13 04:41:13 +09:00
|
|
|
self._sort_formats(formats)
|
|
|
|
|
2020-05-14 20:51:40 +09:00
|
|
|
title = self._og_search_property('title', webpage)
|
2014-11-13 04:41:13 +09:00
|
|
|
|
2014-11-13 23:20:49 +09:00
|
|
|
description = self._html_search_meta(
|
|
|
|
'description', webpage, 'description')
|
2014-11-13 04:41:13 +09:00
|
|
|
|
2020-05-14 20:51:40 +09:00
|
|
|
thumbnail = self._og_search_property('image', webpage)
|
2014-11-13 04:41:13 +09:00
|
|
|
|
2020-05-14 20:51:40 +09:00
|
|
|
categories = re.findall(
|
|
|
|
r'(?s)<a class=[\'"]player-tags__item[\'"][^>]*>(.*?)</a>', webpage
|
|
|
|
)
|
2014-11-13 04:41:13 +09:00
|
|
|
|
|
|
|
return {
|
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'description': description,
|
|
|
|
'thumbnail': thumbnail,
|
|
|
|
'categories': categories,
|
|
|
|
'formats': formats,
|
|
|
|
'age_limit': 18,
|
|
|
|
}
|