Browse Source

Propagate error messages from YouTube API

Noémi Ványi 4 years ago
parent
commit
e158eeee4b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      searx/engines/youtube_api.py

+ 3 - 0
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 []