[extractor/daftsex] Update domain and embed player url (#5966)

Closes #5881
Authored by: JChris246
This commit is contained in:
JChris246 2023-05-28 23:31:26 -04:00 committed by GitHub
parent 738c90a463
commit fc5a7f9b27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 9 deletions

View File

@ -1,6 +1,7 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_b64decode from ..compat import compat_b64decode
from ..utils import ( from ..utils import (
ExtractorError,
int_or_none, int_or_none,
js_to_json, js_to_json,
parse_count, parse_count,
@ -12,21 +13,24 @@ from ..utils import (
class DaftsexIE(InfoExtractor): class DaftsexIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?daftsex\.com/watch/(?P<id>-?\d+_\d+)' _VALID_URL = r'https?://(?:www\.)?daft\.sex/watch/(?P<id>-?\d+_\d+)'
_TESTS = [{ _TESTS = [{
'url': 'https://daftsex.com/watch/-35370899_456246186', 'url': 'https://daft.sex/watch/-35370899_456246186',
'md5': 'd95135e6cea2d905bea20dbe82cda64a', 'md5': '64c04ef7b4c7b04b308f3b0c78efe7cd',
'info_dict': { 'info_dict': {
'id': '-35370899_456246186', 'id': '-35370899_456246186',
'ext': 'mp4', 'ext': 'mp4',
'title': 'just relaxing', 'title': 'just relaxing',
'description': 'just relaxing - Watch video Watch video in high quality', 'description': 'just relaxing Watch video Watch video in high quality',
'upload_date': '20201113', 'upload_date': '20201113',
'timestamp': 1605261911, 'timestamp': 1605261911,
'thumbnail': r're:https://[^/]+/impf/-43BuMDIawmBGr3GLcZ93CYwWf2PBv_tVWoS1A/dnu41DnARU4\.jpg\?size=800x450&quality=96&keep_aspect_ratio=1&background=000000&sign=6af2c26ff4a45e55334189301c867384&type=video_thumb', 'thumbnail': r're:^https?://.*\.jpg$',
'age_limit': 18,
'duration': 15.0,
'view_count': int
}, },
}, { }, {
'url': 'https://daftsex.com/watch/-156601359_456242791', 'url': 'https://daft.sex/watch/-156601359_456242791',
'info_dict': { 'info_dict': {
'id': '-156601359_456242791', 'id': '-156601359_456242791',
'ext': 'mp4', 'ext': 'mp4',
@ -36,6 +40,7 @@ class DaftsexIE(InfoExtractor):
'timestamp': 1600250735, 'timestamp': 1600250735,
'thumbnail': 'https://psv153-1.crazycloud.ru/videos/-156601359/456242791/thumb.jpg?extra=i3D32KaBbBFf9TqDRMAVmQ', 'thumbnail': 'https://psv153-1.crazycloud.ru/videos/-156601359/456242791/thumb.jpg?extra=i3D32KaBbBFf9TqDRMAVmQ',
}, },
'skip': 'deleted / private'
}] }]
def _real_extract(self, url): def _real_extract(self, url):
@ -60,7 +65,7 @@ class DaftsexIE(InfoExtractor):
webpage, 'player color', fatal=False) or '' webpage, 'player color', fatal=False) or ''
embed_page = self._download_webpage( embed_page = self._download_webpage(
'https://daxab.com/player/%s?color=%s' % (player_hash, player_color), 'https://dxb.to/player/%s?color=%s' % (player_hash, player_color),
video_id, headers={'Referer': url}) video_id, headers={'Referer': url})
video_params = self._parse_json( video_params = self._parse_json(
self._search_regex( self._search_regex(
@ -94,15 +99,19 @@ class DaftsexIE(InfoExtractor):
'age_limit': 18, 'age_limit': 18,
} }
item = self._download_json( items = self._download_json(
f'{server_domain}/method/video.get/{video_id}', video_id, f'{server_domain}/method/video.get/{video_id}', video_id,
headers={'Referer': url}, query={ headers={'Referer': url}, query={
'token': video_params['video']['access_token'], 'token': video_params['video']['access_token'],
'videos': video_id, 'videos': video_id,
'ckey': video_params['c_key'], 'ckey': video_params['c_key'],
'credentials': video_params['video']['credentials'], 'credentials': video_params['video']['credentials'],
})['response']['items'][0] })['response']['items']
if not items:
raise ExtractorError('Video is not available', video_id=video_id, expected=True)
item = items[0]
formats = [] formats = []
for f_id, f_url in item.get('files', {}).items(): for f_id, f_url in item.get('files', {}).items():
if f_id == 'external': if f_id == 'external':