Repository: yt-dlp/yt-dlp
Issue category: Bug Report

stripchat extractor not working: "No active stream found"
### DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

- [X] I understand that I will be **blocked** if I *intentionally* remove or skip any mandatory\* field

### Checklist

- [X] I'm reporting that yt-dlp is broken on a **supported** site
- [X] I've verified that I have **updated yt-dlp to nightly or master** ([update instructions](https://github.com/yt-dlp/yt-dlp#update-channels))
- [X] I've checked that all provided URLs are playable in a browser with the same IP and same login details
- [X] I've checked that all URLs and arguments with special characters are [properly quoted or escaped](https://github.com/yt-dlp/yt-dlp/wiki/FAQ#video-url-contains-an-ampersand--and-im-getting-some-strange-output-1-2839-or-v-is-not-recognized-as-an-internal-or-external-command)
- [X] I've searched [known issues](https://github.com/yt-dlp/yt-dlp/issues/3766) and the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues **including closed ones**. DO NOT post duplicates
- [X] I've read the [guidelines for opening an issue](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#opening-an-issue)
- [X] I've read about [sharing account credentials](https://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#are-you-willing-to-share-account-details-if-needed) and I'm willing to share it if required

### Region

Israel

### Provide a description that is worded well enough to be understood

When trying to download a stream from stripchat.com yt-dlp gives back "No active stream" even though a stream is live at the same time. If I paste the m3u8 of the same stream then yt-dlp works and downloads the stream.

sidenote:
I tried to set my yt-dlp to nightly but can't because I downloaded it from homebrew. and using yt-dlp --update-to nightly gives back:
"ERROR: You installed yt-dlp from a manual build or with a package manager; Use that to update"
and no documentation on how to exactly do that.

### Provide verbose output that clearly demonstrates the problem

- [X] Run **your** yt-dlp command with **-vU** flag added (`yt-dlp -vU <your command line>`)
- [ ] If using API, add `'verbose': True` to `YoutubeDL` params instead
- [X] Copy the WHOLE output (starting with `[debug] Command-line config`) and insert it below

### Complete Verbose Output

```shell
[debug] Command-line config: ['-vU', 'https://stripchat.com/MagicLilu']
[debug] Encodings: locale UTF-8, fs utf-8, pref UTF-8, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2024.11.18 from yt-dlp/yt-dlp [7ea278792]
[debug] Python 3.13.0 (CPython arm64 64bit) - macOS-14.6.1-arm64-arm-64bit-Mach-O (OpenSSL 3.4.0 22 Oct 2024)
[debug] exe versions: ffmpeg 7.1 (setts), ffprobe 7.1
[debug] Optional libraries: Cryptodome-3.21.0, brotli-1.1.0, certifi-2024.08.30, mutagen-1.47.0, requests-2.32.3, sqlite3-3.47.0, urllib3-2.2.3, websockets-13.1
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1837 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2024.11.18 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.11.18 from yt-dlp/yt-dlp)
[Stripchat] Extracting URL: https://stripchat.com/MagicLilu
[Stripchat] MagicLilu: Downloading webpage
ERROR: [Stripchat] MagicLilu: No active streams found
  File "/opt/homebrew/Cellar/yt-dlp/HEAD-f919729/libexec/lib/python3.13/site-packages/yt_dlp/extractor/common.py", line 742, in extract
    ie_result = self._real_extract(url)
  File "/opt/homebrew/Cellar/yt-dlp/HEAD-f919729/libexec/lib/python3.13/site-packages/yt_dlp/extractor/stripchat.py", line 56, in _real_extract
    self.raise_no_formats('No active streams found', expected=True)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/yt-dlp/HEAD-f919729/libexec/lib/python3.13/site-packages/yt_dlp/extractor/common.py", line 1276, in raise_no_formats
    raise ExtractorError(msg, expected=expected, video_id=video_id)
```



Functions to edit:
yt_dlp/extractor/stripchat.py:StripchatIE._real_extract

Patch:
diff --git a/yt_dlp/extractor/stripchat.py b/yt_dlp/extractor/stripchat.py
index 31c8afbc6268..84846042f38f 100644
--- a/yt_dlp/extractor/stripchat.py
+++ b/yt_dlp/extractor/stripchat.py
@@ -28,24 +28,21 @@ class StripchatIE(InfoExtractor):
     def _real_extract(self, url):
         video_id = self._match_id(url)
         webpage = self._download_webpage(url, video_id, headers=self.geo_verification_headers())
+        data = self._search_json(
+            r'<script\b[^>]*>\s*window\.__PRELOADED_STATE__\s*=',
+            webpage, 'data', video_id, transform_source=lowercase_escape)
 
-        data = self._parse_json(
-            self._search_regex(
-                r'<script\b[^>]*>\s*window\.__PRELOADED_STATE__\s*=(?P<value>.*?)<\/script>',
-                webpage, 'data', default='{}', group='value'),
-            video_id, transform_source=lowercase_escape, fatal=False)
-        if not data:
-            raise ExtractorError('Unable to find configuration for stream.')
-
-        if traverse_obj(data, ('viewCam', 'show'), expected_type=dict):
-            raise ExtractorError('Model is in private show', expected=True)
-        elif not traverse_obj(data, ('viewCam', 'model', 'isLive'), expected_type=bool):
+        if traverse_obj(data, ('viewCam', 'show', {dict})):
+            raise ExtractorError('Model is in a private show', expected=True)
+        if not traverse_obj(data, ('viewCam', 'model', 'isLive', {bool})):
             raise UserNotLive(video_id=video_id)
 
-        model_id = traverse_obj(data, ('viewCam', 'model', 'id'), expected_type=int)
+        model_id = data['viewCam']['model']['id']
 
         formats = []
-        for host in traverse_obj(data, ('config', 'data', (
+        # HLS hosts are currently found in .configV3.static.features.hlsFallback.fallbackDomains[]
+        # The rest of the path is for backwards compatibility and to guard against A/B testing
+        for host in traverse_obj(data, ((('config', 'data'), ('configV3', 'static')), (
                 (('features', 'featuresV2'), 'hlsFallback', 'fallbackDomains', ...), 'hlsStreamHost'))):
             formats = self._extract_m3u8_formats(
                 f'https://edge-hls.{host}/hls/{model_id}/master/{model_id}_auto.m3u8',
@@ -53,7 +50,7 @@ def _real_extract(self, url):
             if formats:
                 break
         if not formats:
-            self.raise_no_formats('No active streams found', expected=True)
+            self.raise_no_formats('Unable to extract stream host', video_id=video_id)
 
         return {
             'id': video_id,