diff options
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/www500px.py | 73 | ||||
-rw-r--r-- | searx/preferences.py | 3 | ||||
-rw-r--r-- | searx/search.py | 3 | ||||
-rw-r--r-- | searx/settings.yml | 8 | ||||
-rw-r--r-- | searx/templates/__common__/about.html | 1 |
5 files changed, 10 insertions, 78 deletions
diff --git a/searx/engines/www500px.py b/searx/engines/www500px.py deleted file mode 100644 index 7a2015ae9..000000000 --- a/searx/engines/www500px.py +++ /dev/null @@ -1,73 +0,0 @@ -""" - 500px (Images) - - @website https://500px.com - @provide-api yes (https://developers.500px.com/) - - @using-api no - @results HTML - @stable no (HTML can change) - @parse url, title, thumbnail, img_src, content - - @todo rewrite to api -""" - -from json import loads -from searx.url_utils import urlencode, urljoin - -# engine dependent config -categories = ['images'] -paging = True - -# search-url -base_url = 'https://500px.com' -search_url = 'https://api.500px.com/v1/photos/search?type=photos'\ - '&{query}'\ - '&image_size%5B%5D=4'\ - '&image_size%5B%5D=20'\ - '&image_size%5B%5D=21'\ - '&image_size%5B%5D=1080'\ - '&image_size%5B%5D=1600'\ - '&image_size%5B%5D=2048'\ - '&include_states=true'\ - '&formats=jpeg%2Clytro'\ - '&include_tags=true'\ - '&exclude_nude=true'\ - '&page={pageno}'\ - '&rpp=50'\ - '&sdk_key=b68e60cff4c929bedea36ca978830c5caca790c3' - - -# do search-request -def request(query, params): - params['url'] = search_url.format(pageno=params['pageno'], - query=urlencode({'term': query})) - - return params - - -# get response from search-request -def response(resp): - results = [] - - response_json = loads(resp.text) - - # parse results - for result in response_json['photos']: - url = urljoin(base_url, result['url']) - title = result['name'] - # last index is the biggest resolution - img_src = result['image_url'][-1] - thumbnail_src = result['image_url'][0] - content = result['description'] or '' - - # append result - results.append({'url': url, - 'title': title, - 'img_src': img_src, - 'content': content, - 'thumbnail_src': thumbnail_src, - 'template': 'images.html'}) - - # return results - return results diff --git a/searx/preferences.py b/searx/preferences.py index 5ff70191a..ed2cc402a 100644 --- a/searx/preferences.py +++ b/searx/preferences.py @@ -264,6 +264,9 @@ class Preferences(object): 'False': False, 'True': True}), 'doi_resolver': MultipleChoiceSetting(['oadoi.org'], choices=DOI_RESOLVERS), + 'oscar-style': EnumStringSetting( + settings['ui'].get('theme_args', {}).get('oscar_style', 'logicodev'), + choices=['', 'logicodev', 'logicodev-dark', 'pointhi']), } self.engines = EnginesSetting('engines', choices=engines) diff --git a/searx/search.py b/searx/search.py index 945f32197..950a49f23 100644 --- a/searx/search.py +++ b/searx/search.py @@ -147,7 +147,8 @@ def search_one_request_safe(engine_name, query, request_params, result_container if requests_exception: # update continuous_errors / suspend_end_time engine.continuous_errors += 1 - engine.suspend_end_time = time() + min(60, engine.continuous_errors) + engine.suspend_end_time = time() + min(settings['search']['max_ban_time_on_fail'], + engine.continuous_errors * settings['search']['ban_time_on_fail']) else: # no HTTP error (perhaps an engine error) # anyway, reset the suspend variables diff --git a/searx/settings.yml b/searx/settings.yml index 1168ad7a4..2575000c3 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -6,6 +6,8 @@ search: safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default language : "en-US" + ban_time_on_fail : 5 # ban time in seconds after engine errors + max_ban_time_on_fail : 120 # max ban time in seconds after engine errors server: port : 8888 @@ -20,6 +22,8 @@ ui: templates_path : "" # Custom templates path - leave it blank if you didn't change default_theme : oscar # ui theme default_locale : "" # Default interface locale - leave blank to detect from browser information or use codes from the 'locales' config section + theme_args : + oscar_style : logicodev # default style of oscar # searx supports result proxification using an external service: https://github.com/asciimoo/morty # uncomment below section if you have running morty proxy @@ -204,10 +208,6 @@ engines: shortcut : fa disabled : True - - name : 500px - engine : www500px - shortcut : px - - name : 1x engine : www1x shortcut : 1x diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html index d8afab73f..bf1733359 100644 --- a/searx/templates/__common__/about.html +++ b/searx/templates/__common__/about.html @@ -60,3 +60,4 @@ Searx can be added to your browser's search bar; moreover, it can be set as the <p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p> </div> +{% include "__common__/aboutextend.html" ignore missing %} |