Skip to content

Commit

Permalink
[fix] gentoo: use mediawiki engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro authored and return42 committed Jul 3, 2024
1 parent 54be8f0 commit 4eaa0dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 133 deletions.
125 changes: 0 additions & 125 deletions searx/engines/gentoo.py

This file was deleted.

13 changes: 7 additions & 6 deletions searx/engines/mediawiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
ISO 639-1 language code (en, de, fr ..) of the search language.
"""

api_path: str = 'w/api.php'
"""The path the PHP api is listening on.
The default path should work fine usually.
"""

timestamp_format = '%Y-%m-%dT%H:%M:%SZ'
"""The longhand version of MediaWiki time strings."""

Expand All @@ -113,12 +119,7 @@ def request(query, params):
else:
params['language'] = params['language'].split('-')[0]

if base_url.endswith('/'):
api_url = base_url + 'w/api.php?'
else:
api_url = base_url + '/w/api.php?'
api_url = api_url.format(language=params['language'])

api_url = f"{base_url.rstrip('/')}/{api_path}?".format(language=params['language'])
offset = (params['pageno'] - 1) * number_of_results

args = {
Expand Down
8 changes: 6 additions & 2 deletions searx/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,13 @@ engines:
shortcut: gen

- name: gentoo
engine: gentoo
engine: mediawiki
shortcut: ge
timeout: 10.0
categories: ["it", "software wikis"]
base_url: "https://wiki.gentoo.org/"
api_path: "api.php"
search_type: text
timeout: 10

- name: gitlab
engine: json_engine
Expand Down

0 comments on commit 4eaa0dd

Please sign in to comment.