From a0f69f95267780bf87bae2b252245a1145c1d5d6 Mon Sep 17 00:00:00 2001 From: Henrik Heimbuerger Date: Sun, 17 Jan 2021 15:49:12 +0100 Subject: [PATCH] [nebula] Fix stale session issues When Nebula isn't accessed for a while, the Zype access token stored on the Nebula backend expires. It is then no longer returned by the user endpoint. The Nebula frontend has the same issue and keeps polling for the Zype token in this case. This isn't implemented in this extractor yet, but at least a specific error message now prints some helpful advice. --- youtube_dl/extractor/nebula.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/nebula.py b/youtube_dl/extractor/nebula.py index 0023a2883..5b3c2cbf7 100644 --- a/youtube_dl/extractor/nebula.py +++ b/youtube_dl/extractor/nebula.py @@ -141,7 +141,8 @@ class NebulaIE(InfoExtractor): # option #4: nebula token via --videopassword if not nebula_token: nebula_token = self._downloader.params.get('videopassword') - if nebula_token: self.to_screen('Authenticating to Nebula with token from --videopassword') + if nebula_token: + self.to_screen('Authenticating to Nebula with token from --videopassword') if not nebula_token: raise ExtractorError('Nebula requires an account with an active subscription. ' @@ -228,6 +229,8 @@ class NebulaIE(InfoExtractor): user_object = self._call_nebula_api('/auth/user/', video_id, nebula_token, note='Retrieving Zype access token') access_token = try_get(user_object, lambda x: x['zype_auth_info']['access_token'], compat_str) if not access_token: + if try_get(user_object, lambda x: x['is_subscribed'], bool): + raise ExtractorError('Unable to extract Zype access token from Nebula API authentication endpoint, please try loading an arbitrary video in a browser with this account to ''prime'' it for video downloading') raise ExtractorError('Unable to extract Zype access token from Nebula API authentication endpoint') return access_token