From e158eeee4bf69b973659f68a799d5c005aa1c0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Fri, 9 Oct 2020 17:34:26 +0200 Subject: [PATCH] Propagate error messages from YouTube API --- searx/engines/youtube_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/searx/engines/youtube_api.py b/searx/engines/youtube_api.py index 2542169a..4a205ed6 100644 --- a/searx/engines/youtube_api.py +++ b/searx/engines/youtube_api.py @@ -47,6 +47,9 @@ def response(resp): search_results = loads(resp.text) + if 'error' in search_results and 'message' in search_results['error']: + raise Exception(search_results['error']['message']) + # return empty array if there are no results if 'items' not in search_results: return []