]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/stripchat.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
15 class StripchatIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://stripchat\.com/(?P<id>[0-9A-Za-z-_]+)'
18 'url': 'https://stripchat.com/feel_me',
22 'title': 're:^feel_me [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
27 'skip': 'Room is offline',
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(
33 'https://stripchat.com/%s/' % video_id
, video_id
,
34 headers
=self
.geo_verification_headers())
36 data
= self
._parse
_json
(
38 r
'<script\b[^>]*>\s*window\.__PRELOADED_STATE__\s*=(?P<value>.*?)<\/script>',
39 webpage
, 'data', default
='{}', group
='value'),
40 video_id
, transform_source
=lowercase_escape
, fatal
=False)
42 raise ExtractorError('Unable to find configuration for stream.')
44 if try_get(data
, lambda x
: x
['viewCam']['show'], dict):
45 raise ExtractorError('Model is in private show', expected
=True)
46 elif not try_get(data
, lambda x
: x
['viewCam']['model']['isLive'], bool):
47 raise ExtractorError('Model is offline', expected
=True)
49 server
= try_get(data
, lambda x
: x
['viewCam']['viewServers']['flashphoner-hls'], compat_str
)
50 host
= try_get(data
, lambda x
: x
['config']['data']['hlsStreamHost'], compat_str
)
51 model_id
= try_get(data
, lambda x
: x
['viewCam']['model']['id'], int)
53 formats
= self
._extract
_m
3u8_formats
(
54 'https://b-%s.%s/hls/%d/%d.m3u8' % (server
, host
, model_id
, model_id
),
55 video_id
, ext
='mp4', m3u8_id
='hls', fatal
=False, live
=True)
56 self
._sort
_formats
(formats
)
61 'description': self
._og
_search
_description
(webpage
),
64 # Stripchat declares the RTA meta-tag, but in an non-standard format so _rta_search() can't be used