mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user