0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-16 01:25:06 +00:00

[extractor/Stripchat] Fix extractor (#5985)

Authored by bashonly, JChris246
Closes #5963, closes #5866
This commit is contained in:
JChris246 2023-02-12 00:17:37 -04:00 committed by GitHub
parent c62e64cf01
commit 7d5f919bad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,10 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import ExtractorError, lowercase_escape, traverse_obj from ..utils import (
ExtractorError,
UserNotLive,
lowercase_escape,
traverse_obj
)
class StripchatIE(InfoExtractor): class StripchatIE(InfoExtractor):
@ -35,16 +40,16 @@ def _real_extract(self, url):
if traverse_obj(data, ('viewCam', 'show'), expected_type=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 traverse_obj(data, ('viewCam', 'model', 'isLive'), expected_type=bool): elif not traverse_obj(data, ('viewCam', 'model', 'isLive'), expected_type=bool):
raise ExtractorError('Model is offline', expected=True) raise UserNotLive(video_id=video_id)
server = traverse_obj(data, ('viewCam', 'viewServers', 'flashphoner-hls'), expected_type=str) server = traverse_obj(data, ('viewCam', 'viewServers', 'flashphoner-hls'), expected_type=str)
model_id = traverse_obj(data, ('viewCam', 'model', 'id'), expected_type=int) model_id = traverse_obj(data, ('viewCam', 'model', 'id'), expected_type=int)
formats = [] formats = []
for host in traverse_obj(data, ( for host in traverse_obj(data, ('config', 'data', (
'config', 'data', (('featuresV2', 'hlsFallback', 'fallbackDomains', ...), 'hlsStreamHost'))): (('features', 'featuresV2'), 'hlsFallback', 'fallbackDomains', ...), 'hlsStreamHost'))):
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
f'https://b-{server}.{host}/hls/{model_id}/{model_id}.m3u8', f'https://b-{server}.{host}/hls/{model_id}/master/{model_id}_auto.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: if formats:
break break