[wppilot] reduce logging in and throw meaningful errors
This commit is contained in:
parent
64ec930237
commit
e9f7e06635
|
@ -41,6 +41,12 @@ class WPPilotBaseIE(InfoExtractor):
|
||||||
self._login()
|
self._login()
|
||||||
|
|
||||||
def _login(self):
|
def _login(self):
|
||||||
|
if any(cookie.domain == '.wp.pl' and cookie.name == 'netviapisessid'
|
||||||
|
for cookie in self._downloader.cookiejar):
|
||||||
|
# session exists, already logged in
|
||||||
|
self._LOGGED_IN = True
|
||||||
|
return None
|
||||||
|
|
||||||
username, password = self._get_login_info()
|
username, password = self._get_login_info()
|
||||||
if not username:
|
if not username:
|
||||||
return None
|
return None
|
||||||
|
@ -132,6 +138,10 @@ class WPPilotIE(WPPilotBaseIE):
|
||||||
if try_get(close, lambda x: x['data']['status']) == 'ok':
|
if try_get(close, lambda x: x['data']['status']) == 'ok':
|
||||||
return self.url_result('wppilot:%s' % video_id, ie=WPPilotIE.ie_key())
|
return self.url_result('wppilot:%s' % video_id, ie=WPPilotIE.ie_key())
|
||||||
|
|
||||||
|
error = try_get(video, lambda x: x['_meta']['error'])
|
||||||
|
if error:
|
||||||
|
raise ExtractorError(f"WP said: \"{error['name']}\" ({error['code']})")
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
stream_headers = {}
|
stream_headers = {}
|
||||||
if self._LOGGED_IN:
|
if self._LOGGED_IN:
|
||||||
|
|
Loading…
Reference in a new issue