1 from .common
import InfoExtractor
10 class StripchatIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://stripchat\.com/(?P<id>[^/?#]+)'
13 'url': 'https://stripchat.com/Joselin_Flower',
15 'id': 'Joselin_Flower',
17 'title': 're:^Joselin_Flower [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
22 'skip': 'Room is offline',
24 'url': 'https://stripchat.com/Rakhijaan@xh',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
, headers
=self
.geo_verification_headers())
31 data
= self
._search
_json
(
32 r
'<script\b[^>]*>\s*window\.__PRELOADED_STATE__\s*=',
33 webpage
, 'data', video_id
, transform_source
=lowercase_escape
)
35 if traverse_obj(data
, ('viewCam', 'show', {dict}
)):
36 raise ExtractorError('Model is in a private show', expected
=True)
37 if not traverse_obj(data
, ('viewCam', 'model', 'isLive', {bool}
)):
38 raise UserNotLive(video_id
=video_id
)
40 model_id
= data
['viewCam']['model']['id']
43 # HLS hosts are currently found in .configV3.static.features.hlsFallback.fallbackDomains[]
44 # The rest of the path is for backwards compatibility and to guard against A/B testing
45 for host
in traverse_obj(data
, ((('config', 'data'), ('configV3', 'static')), (
46 (('features', 'featuresV2'), 'hlsFallback', 'fallbackDomains', ...), 'hlsStreamHost'))):
47 formats
= self
._extract
_m
3u8_formats
(
48 f
'https://edge-hls.{host}/hls/{model_id}/master/{model_id}_auto.m3u8',
49 video_id
, ext
='mp4', m3u8_id
='hls', fatal
=False, live
=True)
53 self
.raise_no_formats('Unable to extract stream host', video_id
=video_id
)
58 'description': self
._og
_search
_description
(webpage
),
61 # Stripchat declares the RTA meta-tag, but in an non-standard format so _rta_search() can't be used