[mod] various engines: use eval_xpath* functions and searx.exceptions.*

Engine list: ahmia, duckduckgo_images, elasticsearch, google, google_images, google_videos, youtube_api
This commit is contained in:
Alexandre Flament 2020-11-26 17:22:54 +01:00
parent ad72803ed9
commit 64cccae99e
7 changed files with 44 additions and 52 deletions

View file

@ -11,6 +11,7 @@
from json import loads
from dateutil import parser
from urllib.parse import urlencode
from searx.exceptions import SearxEngineAPIException
# engine dependent config
categories = ['videos', 'music']
@ -48,7 +49,7 @@ 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'])
raise SearxEngineAPIException(search_results['error']['message'])
# return empty array if there are no results
if 'items' not in search_results: