]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/stripchat.py
1 from .common
import InfoExtractor
2 from ..utils
import ExtractorError
, lowercase_escape
, traverse_obj
5 class StripchatIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://stripchat\.com/(?P<id>[^/?#]+)'
8 'url': 'https://stripchat.com/Joselin_Flower',
10 'id': 'Joselin_Flower',
12 'title': 're:^Joselin_Flower [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
17 'skip': 'Room is offline',
19 'url': 'https://stripchat.com/Rakhijaan@xh',
23 def _real_extract(self
, url
):
24 video_id
= self
._match
_id
(url
)
25 webpage
= self
._download
_webpage
(url
, video_id
, headers
=self
.geo_verification_headers())
27 data
= self
._parse
_json
(
29 r
'<script\b[^>]*>\s*window\.__PRELOADED_STATE__\s*=(?P<value>.*?)<\/script>',
30 webpage
, 'data', default
='{}', group
='value'),
31 video_id
, transform_source
=lowercase_escape
, fatal
=False)
33 raise ExtractorError('Unable to find configuration for stream.')
35 if traverse_obj(data
, ('viewCam', 'show'), expected_type
=dict):
36 raise ExtractorError('Model is in private show', expected
=True)
37 elif not traverse_obj(data
, ('viewCam', 'model', 'isLive'), expected_type
=bool):
38 raise ExtractorError('Model is offline', expected
=True)
40 server
= traverse_obj(data
, ('viewCam', 'viewServers', 'flashphoner-hls'), expected_type
=str)
41 model_id
= traverse_obj(data
, ('viewCam', 'model', 'id'), expected_type
=int)
44 for host
in traverse_obj(data
, (
45 'config', 'data', (('featuresV2', 'hlsFallback', 'fallbackDomains', ...), 'hlsStreamHost'))):
46 formats
= self
._extract
_m
3u8_formats
(
47 f
'https://b-{server}.{host}/hls/{model_id}/{model_id}.m3u8',
48 video_id
, ext
='mp4', m3u8_id
='hls', fatal
=False, live
=True)
52 self
.raise_no_formats('No active streams found', expected
=True)
54 self
._sort
_formats
(formats
)
59 'description': self
._og
_search
_description
(webpage
),
62 # Stripchat declares the RTA meta-tag, but in an non-standard format so _rta_search() can't be used