[fix] gentoo: use mediawiki engine

This commit is contained in:
Bnyro 2024-07-02 20:43:23 +02:00 committed by Markus Heiser
parent 54be8f09a6
commit 4eaa0dd275
3 changed files with 13 additions and 133 deletions

View file

@ -100,6 +100,12 @@ base_url: str = 'https://{language}.wikipedia.org/'
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."""
@ -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 = {