From 251ed26068428ec25a92e26af41a7974a682067f Mon Sep 17 00:00:00 2001 From: Mozi <29089388+pzhlkj6612@users.noreply.github.com> Date: Tue, 14 Jan 2025 07:40:57 +0000 Subject: [PATCH] check online status; fix test --- yt_dlp/extractor/showuptv.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/yt_dlp/extractor/showuptv.py b/yt_dlp/extractor/showuptv.py index 1f5b69e768..90c2df0d1e 100644 --- a/yt_dlp/extractor/showuptv.py +++ b/yt_dlp/extractor/showuptv.py @@ -1,4 +1,5 @@ from .common import InfoExtractor +from ..utils import UserNotLive class ShowupTvIE(InfoExtractor): @@ -6,21 +7,20 @@ class ShowupTvIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?showup\.tv/(?P[\w-]+)(?:$|[#?])' _TESTS = [{ - 'url': 'https://showup.tv/Kayla', + 'url': 'https://showup.tv/malamisia', 'info_dict': { - 'id': '6c6c81226012516a8121da51c135cf54', + 'id': 'c4dfef41fe4f5e9838028f2f8f160086', 'ext': 'flv', 'live_status': 'is_live', 'url': r're:^rtmp://[\w-]+?\.showup\.tv/webrtc/[a-z0-9]{32}_aac$', - 'title': r're:Kayla - Darmowe sex kamerki, chat na żywo. Seks pokazy online - live show webcams \d{4}-\d{2}-\d{1,2} \d{1,2}:\d{1,2}', - 'uploader_id': 'Kayla', - 'uploader_url': 'https://showup.tv/profile/Kayla', + 'title': r're:malamisia - Darmowe sex kamerki, chat na żywo. Seks pokazy online - live show webcams \d{4}-\d{2}-\d{1,2} \d{1,2}:\d{1,2}', + 'uploader_id': 'malamisia', + 'uploader_url': 'https://showup.tv/profile/malamisia', }, 'params': { # rtmp download 'skip_download': True, }, - 'skip': 'Room is offline', }, { 'url': 'https://showup.tv/_Sensej', 'only_matching': True, @@ -34,21 +34,22 @@ class ShowupTvIE(InfoExtractor): def _extract_player_var(self, variable, html): return self._html_search_regex( - rf'player\.{variable}\s*=\s*(["\'])(?P(?:(?!\1).)+)\1', html, variable, group='value') + rf'player\.{variable}\s*=\s*(["\'])(?P(?:(?!\1).)+)\1', html, variable, group='value', default=None) def _real_extract(self, url): uploader_id = self._match_id(url) webpage = self._download_webpage(url, uploader_id) stream_id = self._extract_player_var('streamID', webpage) - server_url = self._extract_player_var('transcoderAddr', webpage) + if not stream_id: + raise UserNotLive(video_id=uploader_id) return { 'id': stream_id, 'title': self._html_extract_title(webpage), 'uploader_id': uploader_id, 'uploader_url': f'https://showup.tv/profile/{uploader_id}', - 'url': f'rtmp://{server_url}/webrtc/{stream_id}_aac', + 'url': f'rtmp://{self._extract_player_var('transcoderAddr', webpage)}/webrtc/{stream_id}_aac', 'ext': 'flv', 'is_live': True, }