summaryrefslogtreecommitdiff
path: root/searx/plugins/oa_doi_rewrite.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus@darmarit.de>2021-04-04 13:36:33 +0200
committerMarkus Heiser <markus@darmarit.de>2021-04-04 13:36:33 +0200
commitebfd0eb2b79f73eef108ac1ad89c07174ad6441c (patch)
tree44ba843797cc6daa0066c6adc9687f8d565e9e82 /searx/plugins/oa_doi_rewrite.py
parent76a5305ee2b64053d2cc419a312933972795e77d (diff)
downloadsearxng-ebfd0eb2b79f73eef108ac1ad89c07174ad6441c.tar.gz
searxng-ebfd0eb2b79f73eef108ac1ad89c07174ad6441c.zip
[fix] default_doi_resolver in preferences
Instead of a hard-coded `oadoi.org` default, use the default value from `settings.yml`. Fix an issue in the themes: The replacement 'current_doi_resolver' contains the doi_resolver_url, not the name of the DOI resolver. Compare return value of:: searx.plugins.oa_doi_rewrite.get_doi_resolver(...) Fix a typo in `get_doi_resolver(..)`: suggested by @kvch: *L32 should set doi_resolver not doi_resolvers* Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/plugins/oa_doi_rewrite.py')
-rw-r--r--searx/plugins/oa_doi_rewrite.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/searx/plugins/oa_doi_rewrite.py b/searx/plugins/oa_doi_rewrite.py
index eef29f103..02a712942 100644
--- a/searx/plugins/oa_doi_rewrite.py
+++ b/searx/plugins/oa_doi_rewrite.py
@@ -29,7 +29,7 @@ def get_doi_resolver(args, preference_doi_resolver):
doi_resolvers = settings['doi_resolvers']
doi_resolver = args.get('doi_resolver', preference_doi_resolver)[0]
if doi_resolver not in doi_resolvers:
- doi_resolvers = settings['default_doi_resolver']
+ doi_resolver = settings['default_doi_resolver']
doi_resolver_url = doi_resolvers[doi_resolver]
return doi_resolver_url
@@ -40,7 +40,7 @@ def on_result(request, search, result):
doi = extract_doi(result['parsed_url'])
if doi and len(doi) < 50:
- for suffix in ('/', '.pdf', '/full', '/meta', '/abstract'):
+ for suffix in ('/', '.pdf', '.xml', '/full', '/meta', '/abstract'):
if doi.endswith(suffix):
doi = doi[:-len(suffix)]
result['url'] = get_doi_resolver(request.args, request.preferences.get_value('doi_resolver')) + doi