mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-26 10:24:33 +01:00
[SEXU] Moved to API requests (closes #25270)
This commit is contained in:
parent
327593257c
commit
987fbde7da
@ -1,6 +1,9 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import urlencode_postdata
|
||||||
|
|
||||||
|
|
||||||
class SexuIE(InfoExtractor):
|
class SexuIE(InfoExtractor):
|
||||||
@ -12,7 +15,7 @@ class SexuIE(InfoExtractor):
|
|||||||
'id': '961791',
|
'id': '961791',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'md5:4d05a19a5fc049a63dbbaf05fb71d91b',
|
'title': 'md5:4d05a19a5fc049a63dbbaf05fb71d91b',
|
||||||
'description': 'md5:2b75327061310a3afb3fbd7d09e2e403',
|
'description': 'md5:6c7e471f9ac9bc326a9ad27be409f617',
|
||||||
'categories': list, # NSFW
|
'categories': list, # NSFW
|
||||||
'thumbnail': r're:https?://.*\.jpg$',
|
'thumbnail': r're:https?://.*\.jpg$',
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
@ -23,34 +26,29 @@ class SexuIE(InfoExtractor):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
jwvideo = self._parse_json(
|
apiresponse = self._download_json(
|
||||||
self._search_regex(r'\.setup\(\s*({.+?})\s*\);', webpage, 'jwvideo'),
|
'https://sexu.com/api/video-info',
|
||||||
video_id)
|
video_id, data=urlencode_postdata({'videoId': video_id})
|
||||||
|
)
|
||||||
sources = jwvideo['sources']
|
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': source['file'].replace('\\', ''),
|
'url': source.get('src'),
|
||||||
'format_id': source.get('label'),
|
'format_id': source.get('type'),
|
||||||
'height': int(self._search_regex(
|
'height': int(self._search_regex(
|
||||||
r'^(\d+)[pP]', source.get('label', ''), 'height',
|
r'^(\d+)[pP]', source.get('quality', ''), 'height',
|
||||||
default=None)),
|
default=None)),
|
||||||
} for source in sources if source.get('file')]
|
} for source in apiresponse['sources']]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
title = self._html_search_regex(
|
title = self._og_search_property('title', webpage)
|
||||||
r'<title>([^<]+)\s*-\s*Sexu\.Com</title>', webpage, 'title')
|
|
||||||
|
|
||||||
description = self._html_search_meta(
|
description = self._html_search_meta(
|
||||||
'description', webpage, 'description')
|
'description', webpage, 'description')
|
||||||
|
|
||||||
thumbnail = jwvideo.get('image')
|
thumbnail = self._og_search_property('image', webpage)
|
||||||
|
|
||||||
categories_str = self._html_search_meta(
|
categories = re.findall(
|
||||||
'keywords', webpage, 'categories')
|
r'(?s)<a class=[\'"]player-tags__item[\'"][^>]*>(.*?)</a>', webpage
|
||||||
categories = (
|
)
|
||||||
None if categories_str is None
|
|
||||||
else categories_str.split(','))
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user