[twitcasting] Throw proper error for login-only streams (#2290)

Closes #2289

Authored by: Lesmiscore
This commit is contained in:
Lesmiscore (The Hatsune Daishi) 2022-01-12 00:07:51 +09:00 committed by GitHub
parent e04938ab88
commit fabb27fcea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,7 @@
parse_duration, parse_duration,
qualities, qualities,
str_to_int, str_to_int,
traverse_obj,
try_get, try_get,
unified_timestamp, unified_timestamp,
urlencode_postdata, urlencode_postdata,
@ -96,12 +97,17 @@ def _real_extract(self, url):
'Downloading live info', fatal=False) 'Downloading live info', fatal=False)
is_live = 'data-status="online"' in webpage is_live = 'data-status="online"' in webpage
if not traverse_obj(stream_server_data, 'llfmp4') and is_live:
raise ExtractorError('You must be logged in to watch.', expected=True)
formats = [] formats = []
if is_live and not m3u8_url: if is_live and not m3u8_url:
m3u8_url = 'https://twitcasting.tv/%s/metastream.m3u8' % uploader_id m3u8_url = 'https://twitcasting.tv/%s/metastream.m3u8' % uploader_id
if is_live and has_websockets and stream_server_data: if is_live and has_websockets and stream_server_data:
qq = qualities(['base', 'mobilesource', 'main']) qq = qualities(['base', 'mobilesource', 'main'])
for mode, ws_url in stream_server_data['llfmp4']['streams'].items(): streams = traverse_obj(stream_server_data, ('llfmp4', 'streams')) or {}
for mode, ws_url in streams.items():
formats.append({ formats.append({
'url': ws_url, 'url': ws_url,
'format_id': 'ws-%s' % mode, 'format_id': 'ws-%s' % mode,