1
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-03-09 12:50:23 -05:00
yt-dlp/yt_dlp/extractor/showuptv.py

56 lines
2 KiB
Python
Raw Normal View History

2024-09-06 11:56:57 -05:00
from .common import InfoExtractor
2025-01-14 01:40:57 -06:00
from ..utils import UserNotLive
2024-09-06 11:56:57 -05:00
class ShowupTvIE(InfoExtractor):
IE_NAME = 'showup.tv'
_VALID_URL = r'https?://(?:www\.)?showup\.tv/(?P<id>[\w-]+)(?:$|[#?])'
_TESTS = [{
2025-01-14 01:40:57 -06:00
'url': 'https://showup.tv/malamisia',
2024-09-06 11:56:57 -05:00
'info_dict': {
2025-01-14 01:40:57 -06:00
'id': 'c4dfef41fe4f5e9838028f2f8f160086',
2024-09-06 11:56:57 -05:00
'ext': 'flv',
'live_status': 'is_live',
'url': r're:^rtmp://[\w-]+?\.showup\.tv/webrtc/[a-z0-9]{32}_aac$',
2025-01-14 01:40:57 -06:00
'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',
2024-09-06 11:56:57 -05:00
},
'params': {
# rtmp download
'skip_download': True,
},
}, {
'url': 'https://showup.tv/_Sensej',
'only_matching': True,
}, {
'url': 'https://showup.tv/Lina-hill',
'only_matching': True,
}]
def _real_initialize(self):
self._set_cookie('showup.tv', 'accept_rules', 'true')
2025-01-14 01:10:56 -06:00
def _extract_player_var(self, variable, html):
2024-09-06 11:56:57 -05:00
return self._html_search_regex(
2025-01-14 01:40:57 -06:00
rf'player\.{variable}\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1', html, variable, group='value', default=None)
2024-09-06 11:56:57 -05:00
def _real_extract(self, url):
uploader_id = self._match_id(url)
webpage = self._download_webpage(url, uploader_id)
2025-01-14 01:10:56 -06:00
stream_id = self._extract_player_var('streamID', webpage)
2025-01-14 01:40:57 -06:00
if not stream_id:
raise UserNotLive(video_id=uploader_id)
2024-09-06 11:56:57 -05:00
return {
'id': stream_id,
'title': self._html_extract_title(webpage),
'uploader_id': uploader_id,
'uploader_url': f'https://showup.tv/profile/{uploader_id}',
2025-01-14 01:40:57 -06:00
'url': f'rtmp://{self._extract_player_var('transcoderAddr', webpage)}/webrtc/{stream_id}_aac',
2024-09-06 11:56:57 -05:00
'ext': 'flv',
'is_live': True,
}