summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2022-01-06 09:22:02 +0100
committerGitHub <noreply@github.com>2022-01-06 09:22:02 +0100
commitaedd6279b3d13778aab5d401ee3b9d4d247365c4 (patch)
treec10d95ca4eb907d269df2b6392567d15765f0dec /searx/engines
parent0ebad8220fe574c690d113d7e9d6a85f5ac16616 (diff)
parenta4c2cfb837a3f92e2c0f0b8a0bac7a6e03499640 (diff)
Merge pull request #634 from not-my-profile/powered-by
Introduce `categories_as_tabs` & group engines in tabs
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/__init__.py30
-rw-r--r--searx/engines/apkmirror.py2
-rw-r--r--searx/engines/archlinux.py2
-rw-r--r--searx/engines/bing.py2
-rw-r--r--searx/engines/bing_images.py2
-rw-r--r--searx/engines/bing_videos.py2
-rw-r--r--searx/engines/duckduckgo.py2
-rw-r--r--searx/engines/duckduckgo_images.py2
-rw-r--r--searx/engines/duden.py2
-rw-r--r--searx/engines/etools.py2
-rw-r--r--searx/engines/fdroid.py2
-rw-r--r--searx/engines/genius.py2
-rw-r--r--searx/engines/gentoo.py2
-rw-r--r--searx/engines/gigablast.py2
-rw-r--r--searx/engines/github.py2
-rw-r--r--searx/engines/google.py2
-rw-r--r--searx/engines/google_images.py2
-rw-r--r--searx/engines/google_videos.py2
-rw-r--r--searx/engines/imdb.py4
-rw-r--r--searx/engines/seznam.py1
-rw-r--r--searx/engines/sjp.py2
-rw-r--r--searx/engines/startpage.py2
-rw-r--r--searx/engines/translated.py2
-rw-r--r--searx/engines/yahoo.py2
24 files changed, 52 insertions, 25 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index a3dd7a95a..7e8336e01 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -13,6 +13,7 @@ usage::
import sys
import copy
+from typing import List
from os.path import realpath, dirname
from babel.localedata import locale_identifiers
@@ -44,7 +45,29 @@ ENGINE_DEFAULT_ARGS = {
"display_error_messages": True,
"tokens": [],
}
-"""Defaults for the namespace of an engine module, see :py:func:`load_engine`"""
+# set automatically when an engine does not have any tab category
+OTHER_CATEGORY = 'other'
+
+
+class Engine: # pylint: disable=too-few-public-methods
+ """This class is currently never initialized and only used for type hinting."""
+
+ name: str
+ engine: str
+ shortcut: str
+ categories: List[str]
+ supported_languages: List[str]
+ about: dict
+ inactive: bool
+ disabled: bool
+ language_support: bool
+ paging: bool
+ safesearch: bool
+ time_range_support: bool
+ timeout: float
+
+
+# Defaults for the namespace of an engine module, see :py:func:`load_engine``
categories = {'general': []}
engines = {}
@@ -113,6 +136,9 @@ def load_engine(engine_data):
set_loggers(engine, engine_name)
+ if not any(cat in settings['categories_as_tabs'] for cat in engine.categories):
+ engine.categories.append(OTHER_CATEGORY)
+
return engine
@@ -138,6 +164,8 @@ def update_engine_attributes(engine, engine_data):
if isinstance(param_value, str):
param_value = list(map(str.strip, param_value.split(',')))
engine.categories = param_value
+ elif hasattr(engine, 'about') and param_name == 'about':
+ engine.about = {**engine.about, **engine_data['about']}
else:
setattr(engine, param_name, param_value)
diff --git a/searx/engines/apkmirror.py b/searx/engines/apkmirror.py
index da84bc79e..ac7cd7431 100644
--- a/searx/engines/apkmirror.py
+++ b/searx/engines/apkmirror.py
@@ -24,7 +24,7 @@ about = {
}
# engine dependent config
-categories = ['files']
+categories = ['files', 'apps']
paging = True
time_range_support = False
diff --git a/searx/engines/archlinux.py b/searx/engines/archlinux.py
index 1cfb3983f..b5e426107 100644
--- a/searx/engines/archlinux.py
+++ b/searx/engines/archlinux.py
@@ -20,7 +20,7 @@ about = {
}
# engine dependent config
-categories = ['it']
+categories = ['it', 'software wikis']
paging = True
base_url = 'https://wiki.archlinux.org'
diff --git a/searx/engines/bing.py b/searx/engines/bing.py
index 1170227ad..9744b1800 100644
--- a/searx/engines/bing.py
+++ b/searx/engines/bing.py
@@ -20,7 +20,7 @@ about = {
}
# engine dependent config
-categories = ['general']
+categories = ['general', 'web']
paging = True
time_range_support = False
safesearch = False
diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index f07d07144..cb69dc172 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -27,7 +27,7 @@ about = {
}
# engine dependent config
-categories = ['images']
+categories = ['images', 'web']
paging = True
safesearch = True
time_range_support = True
diff --git a/searx/engines/bing_videos.py b/searx/engines/bing_videos.py
index 184f564df..ae8e8d49a 100644
--- a/searx/engines/bing_videos.py
+++ b/searx/engines/bing_videos.py
@@ -26,7 +26,7 @@ about = {
"results": 'HTML',
}
-categories = ['videos']
+categories = ['videos', 'web']
paging = True
safesearch = True
time_range_support = True
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 0d2a524df..71da72677 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -27,7 +27,7 @@ about = {
}
# engine dependent config
-categories = ['general']
+categories = ['general', 'web']
paging = True
supported_languages_url = 'https://duckduckgo.com/util/u588.js'
time_range_support = True
diff --git a/searx/engines/duckduckgo_images.py b/searx/engines/duckduckgo_images.py
index 2f75e16f1..7d844b543 100644
--- a/searx/engines/duckduckgo_images.py
+++ b/searx/engines/duckduckgo_images.py
@@ -27,7 +27,7 @@ about = {
}
# engine dependent config
-categories = ['images']
+categories = ['images', 'web']
paging = True
safesearch = True
diff --git a/searx/engines/duden.py b/searx/engines/duden.py
index 600b61f3c..da4c4f7da 100644
--- a/searx/engines/duden.py
+++ b/searx/engines/duden.py
@@ -19,7 +19,7 @@ about = {
"language": 'de',
}
-categories = ['general']
+categories = ['dictionaries']
paging = True
# search-url
diff --git a/searx/engines/etools.py b/searx/engines/etools.py
index 347463291..08bc63cd8 100644
--- a/searx/engines/etools.py
+++ b/searx/engines/etools.py
@@ -17,7 +17,7 @@ about = {
"results": 'HTML',
}
-categories = ['general']
+categories = ['general', 'web']
paging = False
safesearch = True
diff --git a/searx/engines/fdroid.py b/searx/engines/fdroid.py
index c381b25d4..b5f004e7b 100644
--- a/searx/engines/fdroid.py
+++ b/searx/engines/fdroid.py
@@ -18,7 +18,7 @@ about = {
}
# engine dependent config
-categories = ['files']
+categories = ['files', 'apps']
paging = True
# search-url
diff --git a/searx/engines/genius.py b/searx/engines/genius.py
index b0fcb09a8..1f4b4b03e 100644
--- a/searx/engines/genius.py
+++ b/searx/engines/genius.py
@@ -20,7 +20,7 @@ about = {
}
# engine dependent config
-categories = ['music']
+categories = ['music', 'lyrics']
paging = True
page_size = 5
diff --git a/searx/engines/gentoo.py b/searx/engines/gentoo.py
index 5b9edafe0..856c93710 100644
--- a/searx/engines/gentoo.py
+++ b/searx/engines/gentoo.py
@@ -18,7 +18,7 @@ about = {
}
# engine dependent config
-categories = ['it']
+categories = ['it', 'software wikis']
paging = True
base_url = 'https://wiki.gentoo.org'
diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py
index c657dca30..1c40ff331 100644
--- a/searx/engines/gigablast.py
+++ b/searx/engines/gigablast.py
@@ -22,7 +22,7 @@ about = {
}
# engine dependent config
-categories = ['general']
+categories = ['general', 'web']
# gigablast's pagination is totally damaged, don't use it
paging = False
safesearch = True
diff --git a/searx/engines/github.py b/searx/engines/github.py
index 1d12d296a..343f3793d 100644
--- a/searx/engines/github.py
+++ b/searx/engines/github.py
@@ -17,7 +17,7 @@ about = {
}
# engine dependent config
-categories = ['it']
+categories = ['it', 'repos']
# search-url
search_url = 'https://api.github.com/search/repositories?sort=stars&order=desc&{query}' # noqa
diff --git a/searx/engines/google.py b/searx/engines/google.py
index 685697d29..ed4381f47 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -41,7 +41,7 @@ about = {
}
# engine dependent config
-categories = ['general']
+categories = ['general', 'web']
paging = True
time_range_support = True
safesearch = True
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py
index 203df404a..2855860d8 100644
--- a/searx/engines/google_images.py
+++ b/searx/engines/google_images.py
@@ -45,7 +45,7 @@ about = {
}
# engine dependent config
-categories = ['images']
+categories = ['images', 'web']
paging = False
use_locale_domain = True
time_range_support = True
diff --git a/searx/engines/google_videos.py b/searx/engines/google_videos.py
index 049f9138c..06aac8ae1 100644
--- a/searx/engines/google_videos.py
+++ b/searx/engines/google_videos.py
@@ -54,7 +54,7 @@ about = {
# engine dependent config
-categories = ['videos']
+categories = ['videos', 'web']
paging = False
language_support = True
use_locale_domain = True
diff --git a/searx/engines/imdb.py b/searx/engines/imdb.py
index bb6258cf4..0897b8dca 100644
--- a/searx/engines/imdb.py
+++ b/searx/engines/imdb.py
@@ -27,9 +27,7 @@ about = {
"results": 'HTML',
}
-categories = [
- 'general',
-]
+categories = []
paging = False
# suggestion_url = "https://sg.media-imdb.com/suggestion/{letter}/{query}.json"
diff --git a/searx/engines/seznam.py b/searx/engines/seznam.py
index 2e95b4769..48a167ce0 100644
--- a/searx/engines/seznam.py
+++ b/searx/engines/seznam.py
@@ -25,6 +25,7 @@ about = {
"language": "cz",
}
+categories = ['general', 'web']
base_url = 'https://search.seznam.cz/'
diff --git a/searx/engines/sjp.py b/searx/engines/sjp.py
index ad498b847..8342a2819 100644
--- a/searx/engines/sjp.py
+++ b/searx/engines/sjp.py
@@ -21,7 +21,7 @@ about = {
"language": 'pl',
}
-categories = ['general']
+categories = ['dictionaries']
paging = False
URL = 'https://sjp.pwn.pl'
diff --git a/searx/engines/startpage.py b/searx/engines/startpage.py
index 65d90debe..97891921c 100644
--- a/searx/engines/startpage.py
+++ b/searx/engines/startpage.py
@@ -23,7 +23,7 @@ about = {
}
# engine dependent config
-categories = ['general']
+categories = ['general', 'web']
# there is a mechanism to block "bot" search
# (probably the parameter qid), require
# storing of qid's between mulitble search-calls
diff --git a/searx/engines/translated.py b/searx/engines/translated.py
index 62ade49e2..9900c017b 100644
--- a/searx/engines/translated.py
+++ b/searx/engines/translated.py
@@ -14,7 +14,7 @@ about = {
}
engine_type = 'online_dictionary'
-categories = ['general']
+categories = ['dictionaries']
url = 'https://api.mymemory.translated.net/get?q={query}&langpair={from_lang}|{to_lang}{key}'
web_url = 'https://mymemory.translated.net/en/{from_lang}/{to_lang}/{query}'
weight = 100
diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py
index 08bde6665..6bf1932e4 100644
--- a/searx/engines/yahoo.py
+++ b/searx/engines/yahoo.py
@@ -31,7 +31,7 @@ about = {
}
# engine dependent config
-categories = ['general']
+categories = ['general', 'web']
paging = True
time_range_support = True
supported_languages_url = 'https://search.yahoo.com/preferences/languages'