diff options
author | Lesmiscore (The Hatsune Daishi) <nao20010128@gmail.com> | 2022-01-12 00:07:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 00:07:51 +0900 |
commit | fabb27fcea6bed4f751bd95d7301067452b1e21e (patch) | |
tree | 32562f5c906c0a30d1dfaebd5bbbebc2dbbcf523 | |
parent | e04938ab88fc1fb4560f6cceb32525ef6e7f47a4 (diff) | |
download | hypervideo-pre-fabb27fcea6bed4f751bd95d7301067452b1e21e.tar.lz hypervideo-pre-fabb27fcea6bed4f751bd95d7301067452b1e21e.tar.xz hypervideo-pre-fabb27fcea6bed4f751bd95d7301067452b1e21e.zip |
[twitcasting] Throw proper error for login-only streams (#2290)
Closes #2289
Authored by: Lesmiscore
-rw-r--r-- | yt_dlp/extractor/twitcasting.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/yt_dlp/extractor/twitcasting.py b/yt_dlp/extractor/twitcasting.py index 3acf1b118..ef1e871cf 100644 --- a/yt_dlp/extractor/twitcasting.py +++ b/yt_dlp/extractor/twitcasting.py @@ -14,6 +14,7 @@ from ..utils import ( parse_duration, qualities, str_to_int, + traverse_obj, try_get, unified_timestamp, urlencode_postdata, @@ -96,12 +97,17 @@ class TwitCastingIE(InfoExtractor): 'Downloading live info', fatal=False) 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 = [] if is_live and not m3u8_url: m3u8_url = 'https://twitcasting.tv/%s/metastream.m3u8' % uploader_id if is_live and has_websockets and stream_server_data: 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({ 'url': ws_url, 'format_id': 'ws-%s' % mode, |