From 4b5eec0aaa7c02627f27a386591b735b90e681a8 Mon Sep 17 00:00:00 2001 From: Jakob Kruse Date: Sun, 24 Nov 2024 23:20:30 +0100 Subject: [PATCH] [ie/chaturbate] Fix support for non-public streams (#11624) Fix bug in 720b3dc453c342bc2e8df7dbc0acaab4479de46c Closes #11623 Authored by: jkruse --- yt_dlp/extractor/chaturbate.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/yt_dlp/extractor/chaturbate.py b/yt_dlp/extractor/chaturbate.py index a40b7d39c7f4..d031d3985e33 100644 --- a/yt_dlp/extractor/chaturbate.py +++ b/yt_dlp/extractor/chaturbate.py @@ -59,17 +59,16 @@ def _extract_from_api(self, video_id, tld): 'Accept': 'application/json', }, fatal=False, impersonate=True) or {} - status = response.get('room_status') - if status != 'public': + m3u8_url = response.get('url') + if not m3u8_url: + status = response.get('room_status') if error := self._ERROR_MAP.get(status): raise ExtractorError(error, expected=True) - self.report_warning('Falling back to webpage extraction') + if status == 'public': + self.raise_geo_restricted() + self.report_warning(f'Got status "{status}" from API; falling back to webpage extraction') return None - m3u8_url = response.get('url') - if not m3u8_url: - self.raise_geo_restricted() - return { 'id': video_id, 'title': video_id,