mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-15 07:42:42 +00:00
[lbry] Show error message from API response
This commit is contained in:
parent
9ada988bfc
commit
8100c77223
1 changed files with 7 additions and 2 deletions
|
@ -28,14 +28,19 @@ class LBRYBaseIE(InfoExtractor):
|
||||||
_SUPPORTED_STREAM_TYPES = ['video', 'audio']
|
_SUPPORTED_STREAM_TYPES = ['video', 'audio']
|
||||||
|
|
||||||
def _call_api_proxy(self, method, display_id, params, resource):
|
def _call_api_proxy(self, method, display_id, params, resource):
|
||||||
return self._download_json(
|
response = self._download_json(
|
||||||
'https://api.lbry.tv/api/v1/proxy',
|
'https://api.lbry.tv/api/v1/proxy',
|
||||||
display_id, 'Downloading %s JSON metadata' % resource,
|
display_id, 'Downloading %s JSON metadata' % resource,
|
||||||
headers={'Content-Type': 'application/json-rpc'},
|
headers={'Content-Type': 'application/json-rpc'},
|
||||||
data=json.dumps({
|
data=json.dumps({
|
||||||
'method': method,
|
'method': method,
|
||||||
'params': params,
|
'params': params,
|
||||||
}).encode())['result']
|
}).encode())
|
||||||
|
err = response.get('error')
|
||||||
|
if err:
|
||||||
|
raise ExtractorError(
|
||||||
|
f'{self.IE_NAME} said: {err.get("code")} - {err.get("message")}', expected=True)
|
||||||
|
return response['result']
|
||||||
|
|
||||||
def _resolve_url(self, url, display_id, resource):
|
def _resolve_url(self, url, display_id, resource):
|
||||||
return self._call_api_proxy(
|
return self._call_api_proxy(
|
||||||
|
|
Loading…
Reference in a new issue