forked from Icycoide/searxng
[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:
parent
ad72803ed9
commit
64cccae99e
7 changed files with 44 additions and 52 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue