mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-22 18:17:17 -05:00
[extractor/stripchat] Fix hostname for HLS stream (#5445)
Closes #5227 Authored by: zulaport
This commit is contained in:
parent
ac8e69dd32
commit
a349d4d641
@ -1,22 +1,15 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..utils import ExtractorError, lowercase_escape, traverse_obj
|
||||||
compat_str,
|
|
||||||
)
|
|
||||||
from ..utils import (
|
|
||||||
ExtractorError,
|
|
||||||
lowercase_escape,
|
|
||||||
try_get,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class StripchatIE(InfoExtractor):
|
class StripchatIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://stripchat\.com/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://stripchat\.com/(?P<id>[^/?#]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://stripchat.com/feel_me',
|
'url': 'https://stripchat.com/Joselin_Flower',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'feel_me',
|
'id': 'Joselin_Flower',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 're:^feel_me [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
'title': 're:^Joselin_Flower [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
|
||||||
'description': str,
|
'description': str,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
@ -39,18 +32,22 @@ class StripchatIE(InfoExtractor):
|
|||||||
if not data:
|
if not data:
|
||||||
raise ExtractorError('Unable to find configuration for stream.')
|
raise ExtractorError('Unable to find configuration for stream.')
|
||||||
|
|
||||||
if try_get(data, lambda x: x['viewCam']['show'], dict):
|
if traverse_obj(data, ('viewCam', 'show'), expected_type=dict):
|
||||||
raise ExtractorError('Model is in private show', expected=True)
|
raise ExtractorError('Model is in private show', expected=True)
|
||||||
elif not try_get(data, lambda x: x['viewCam']['model']['isLive'], bool):
|
elif not traverse_obj(data, ('viewCam', 'model', 'isLive'), expected_type=bool):
|
||||||
raise ExtractorError('Model is offline', expected=True)
|
raise ExtractorError('Model is offline', expected=True)
|
||||||
|
|
||||||
server = try_get(data, lambda x: x['viewCam']['viewServers']['flashphoner-hls'], compat_str)
|
server = traverse_obj(data, ('viewCam', 'viewServers', 'flashphoner-hls'), expected_type=str)
|
||||||
host = try_get(data, lambda x: x['config']['data']['hlsStreamHost'], compat_str)
|
model_id = traverse_obj(data, ('viewCam', 'model', 'id'), expected_type=int)
|
||||||
model_id = try_get(data, lambda x: x['viewCam']['model']['id'], int)
|
|
||||||
|
|
||||||
|
for host in traverse_obj(data, (
|
||||||
|
'config', 'data', (('featuresV2', 'hlsFallback', 'fallbackDomains', ...), 'hlsStreamHost'))):
|
||||||
formats = self._extract_m3u8_formats(
|
formats = self._extract_m3u8_formats(
|
||||||
'https://b-%s.%s/hls/%d/%d.m3u8' % (server, host, model_id, model_id),
|
f'https://b-{server}.{host}/hls/{model_id}/{model_id}.m3u8',
|
||||||
video_id, ext='mp4', m3u8_id='hls', fatal=False, live=True)
|
video_id, ext='mp4', m3u8_id='hls', fatal=False, live=True)
|
||||||
|
if formats:
|
||||||
|
break
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
Reference in New Issue
Block a user