Bladeren bron

Merge 53c139853736f947e78c59a6d3398108fa1d2232 into cc97a5a5f5980e2742a1a2ac6b084210e071ff1e

Alexandre Flament 6 jaren geleden
bovenliggende
commit
26f4f68f55
Geen account gekoppeld aan de committers e-mail
8 gewijzigde bestanden met toevoegingen van 869 en 738 verwijderingen
  1. 92
    10
      searx/__init__.py
  2. 5
    0
      searx/doi.yml
  3. 632
    0
      searx/engines.yml
  4. 31
    0
      searx/locales.yml
  5. 6
    5
      searx/plugins/oa_doi_rewrite.py
  6. 1
    1
      searx/preferences.py
  7. 99
    719
      searx/settings.yml
  8. 3
    3
      searx/webapp.py

+ 92
- 10
searx/__init__.py Bestand weergeven

@@ -19,7 +19,7 @@ import certifi
19 19
 import logging
20 20
 from os import environ
21 21
 from os.path import realpath, dirname, join, abspath, isfile
22
-from io import open
22
+from io import open as io_open
23 23
 from ssl import OPENSSL_VERSION_INFO, OPENSSL_VERSION
24 24
 try:
25 25
     from yaml import load
@@ -32,27 +32,62 @@ searx_dir = abspath(dirname(__file__))
32 32
 engine_dir = dirname(realpath(__file__))
33 33
 
34 34
 
35
-def check_settings_yml(file_name):
35
+def build_key_to_index(seq, key):
36
+    return dict((d[key], index) for (index, d) in enumerate(seq))
37
+
38
+
39
+def file_or_none(file_name):
36 40
     if isfile(file_name):
37 41
         return file_name
38 42
     else:
39 43
         return None
40 44
 
45
+
46
+def load_yaml(file_name):
47
+    with io_open(file_name, 'r', encoding='utf-8') as file_yaml:
48
+        return load(file_yaml)
49
+
50
+
51
+def get_embedded_filename(name):
52
+    return join(searx_dir, name)
53
+
54
+
55
+def update_settings_with_path(settings, path, key=None):
56
+    if path is None or path == '':
57
+        return
58
+    elif isfile(path):
59
+        logger.debug('read configuration from %s', path)
60
+        y = load_yaml(path)
61
+        if isinstance(settings, dict):
62
+            settings.update(y)
63
+        elif isinstance(settings, list):
64
+            kindex = build_key_to_index(settings, key)
65
+            for e in y:
66
+                if key is not None and key in e:
67
+                    i = kindex.get(e[key], None)
68
+                    if i is not None:
69
+                        settings[i] = e
70
+                        continue
71
+                settings.append(e)
72
+        else:
73
+            logger.error('%s content is neither a list nor a dictionary')
74
+    else:
75
+        logger.error('%s is not a file', path)
76
+
77
+
41 78
 # find location of settings.yml
42 79
 if 'SEARX_SETTINGS_PATH' in environ:
43 80
     # if possible set path to settings using the
44 81
     # enviroment variable SEARX_SETTINGS_PATH
45
-    settings_path = check_settings_yml(environ['SEARX_SETTINGS_PATH'])
82
+    user_settings_path = file_or_none(environ['SEARX_SETTINGS_PATH'])
46 83
 else:
47 84
     # if not, get it from searx code base or last solution from /etc/searx
48
-    settings_path = check_settings_yml(join(searx_dir, 'settings.yml')) or check_settings_yml('/etc/searx/settings.yml')
85
+    user_settings_path = file_or_none(get_embedded_filename('settings.yml')) or file_or_none('/etc/searx/settings.yml')
49 86
 
50
-if not settings_path:
87
+if not user_settings_path:
51 88
     raise Exception('settings.yml not found')
52 89
 
53
-# load settings
54
-with open(settings_path, 'r', encoding='utf-8') as settings_yaml:
55
-    settings = load(settings_yaml)
90
+user_settings = load_yaml(user_settings_path)
56 91
 
57 92
 '''
58 93
 enable debug if
@@ -71,7 +106,7 @@ if searx_debug_env == 'true' or searx_debug_env == '1':
71 106
 elif searx_debug_env == 'false' or searx_debug_env == '0':
72 107
     searx_debug = False
73 108
 else:
74
-    searx_debug = settings.get('general', {}).get('debug')
109
+    searx_debug = user_settings.get('general', {}).get('debug')
75 110
 
76 111
 if searx_debug:
77 112
     logging.basicConfig(level=logging.DEBUG)
@@ -79,7 +114,7 @@ else:
79 114
     logging.basicConfig(level=logging.WARNING)
80 115
 
81 116
 logger = logging.getLogger('searx')
82
-logger.debug('read configuration from %s', settings_path)
117
+logger.debug('read configuration from %s', user_settings_path)
83 118
 # Workaround for openssl versions <1.0.2
84 119
 # https://github.com/certifi/python-certifi/issues/26
85 120
 if OPENSSL_VERSION_INFO[0:3] < (1, 0, 2):
@@ -87,6 +122,53 @@ if OPENSSL_VERSION_INFO[0:3] < (1, 0, 2):
87 122
         environ['REQUESTS_CA_BUNDLE'] = certifi.old_where()
88 123
     logger.warning('You are using an old openssl version({0}), please upgrade above 1.0.2!'.format(OPENSSL_VERSION))
89 124
 
125
+'''
126
+Load all settings
127
+'''
128
+# settings are merged from different yml files
129
+settings = {
130
+    'search': {
131
+        'engines': list()
132
+    },
133
+    'engines': list(),
134
+    'locales': dict(),
135
+    'doi': dict()
136
+}
137
+# load embedded settings first
138
+update_settings_with_path(settings['engines'],
139
+                          user_settings.get('search', {}).get('engines_path', None)
140
+                          or get_embedded_filename('engines.yml'))
141
+update_settings_with_path(settings['doi'], get_embedded_filename('doi.yml'))
142
+update_settings_with_path(settings['locales'], get_embedded_filename('locales.yml'))
143
+# load user settings (may override embedded settings)
144
+settings.update(user_settings)
145
+# add additional engines (replace engine definition if it already exists)
146
+update_settings_with_path(settings['engines'],
147
+                          user_settings.get('search', {}).get('include_engines_path', None), 'name')
148
+# are there some user engine settings ?
149
+user_engine_settings = settings.get('search', {}).get('engines', None)
150
+if user_engine_settings:
151
+    # Yes there are, so disable all engines by default
152
+    for e in settings['engines']:
153
+        e['disabled'] = True
154
+
155
+    # merge settings "search.engines" into "engines"
156
+    engines_by_names = build_key_to_index(settings['engines'], 'name')
157
+    for e in user_engine_settings:
158
+        name = e['name']
159
+        del e['name']
160
+        # enable engine
161
+        e['disabled'] = False
162
+        # merge settings
163
+        if name in engines_by_names:
164
+            settings['engines'][engines_by_names[name]].update(e)
165
+        else:
166
+            logger.error('{0} is not an engine')
167
+
168
+    # merge done : delete user engine settings
169
+    del settings['search']['engines']
170
+
171
+#
90 172
 logger.info('Initialisation done')
91 173
 
92 174
 if 'SEARX_SECRET' in environ:

+ 5
- 0
searx/doi.yml Bestand weergeven

@@ -0,0 +1,5 @@
1
+resolvers :
2
+  oadoi.org : 'https://oadoi.org/'
3
+  doi.org : 'https://doi.org/'
4
+  doai.io  : 'http://doai.io/'
5
+default: 'oadoi.org'

+ 632
- 0
searx/engines.yml Bestand weergeven

@@ -0,0 +1,632 @@
1
+- name : arch linux wiki
2
+  engine : archlinux
3
+  shortcut : al
4
+
5
+- name : archive is
6
+  engine : xpath
7
+  search_url : https://archive.is/{query}
8
+  url_xpath : (//div[@class="TEXT-BLOCK"]/a)/@href
9
+  title_xpath : (//div[@class="TEXT-BLOCK"]/a)
10
+  content_xpath : //div[@class="TEXT-BLOCK"]/ul/li
11
+  categories : general
12
+  timeout : 7.0
13
+  shortcut : ai
14
+
15
+- name : arxiv
16
+  engine : arxiv
17
+  shortcut : arx
18
+  categories : science
19
+  timeout : 4.0
20
+
21
+- name : asksteem
22
+  engine : asksteem
23
+  shortcut : as
24
+
25
+- name : base
26
+  engine : base
27
+  shortcut : bs
28
+
29
+- name : wikipedia
30
+  engine : wikipedia
31
+  shortcut : wp
32
+  base_url : 'https://{language}.wikipedia.org/'
33
+
34
+- name : bing
35
+  engine : bing
36
+  shortcut : bi
37
+
38
+- name : bing images
39
+  engine : bing_images
40
+  shortcut : bii
41
+
42
+- name : bing news
43
+  engine : bing_news
44
+  shortcut : bin
45
+
46
+- name : bing videos
47
+  engine : bing_videos
48
+  shortcut : biv
49
+
50
+- name : bitbucket
51
+  engine : xpath
52
+  paging : True
53
+  search_url : https://bitbucket.org/repo/all/{pageno}?name={query}
54
+  url_xpath : //article[@class="repo-summary"]//a[@class="repo-link"]/@href
55
+  title_xpath : //article[@class="repo-summary"]//a[@class="repo-link"]
56
+  content_xpath : //article[@class="repo-summary"]/p
57
+  categories : it
58
+  timeout : 4.0
59
+  shortcut : bb
60
+
61
+- name : ccc-tv
62
+  engine : xpath
63
+  paging : False
64
+  search_url : https://media.ccc.de/search/?q={query}
65
+  url_xpath : //div[@class="caption"]/h3/a/@href
66
+  title_xpath : //div[@class="caption"]/h3/a/text()
67
+  content_xpath : //div[@class="caption"]/h4/@title
68
+  categories : videos
69
+  shortcut : c3tv
70
+
71
+- name : crossref
72
+  engine : json_engine
73
+  paging : True
74
+  search_url : http://search.crossref.org/dois?q={query}&page={pageno}
75
+  url_query : doi
76
+  title_query : title
77
+  content_query : fullCitation
78
+  categories : science
79
+  shortcut : cr
80
+
81
+- name : currency
82
+  engine : currency_convert
83
+  categories : general
84
+  shortcut : cc
85
+
86
+- name : deezer
87
+  engine : deezer
88
+  shortcut : dz
89
+
90
+- name : deviantart
91
+  engine : deviantart
92
+  shortcut : da
93
+  timeout: 3.0
94
+
95
+- name : ddg definitions
96
+  engine : duckduckgo_definitions
97
+  shortcut : ddd
98
+  weight : 2
99
+
100
+- name : digbt
101
+  engine : digbt
102
+  shortcut : dbt
103
+  timeout : 6.0
104
+
105
+- name : digg
106
+  engine : digg
107
+  shortcut : dg
108
+
109
+- name : erowid
110
+  engine : xpath
111
+  paging : True
112
+  first_page_num : 0
113
+  page_size : 30
114
+  search_url : https://www.erowid.org/search.php?q={query}&s={pageno}
115
+  url_xpath : //dl[@class="results-list"]/dt[@class="result-title"]/a/@href
116
+  title_xpath : //dl[@class="results-list"]/dt[@class="result-title"]/a/text()
117
+  content_xpath : //dl[@class="results-list"]/dd[@class="result-details"]
118
+  categories : general
119
+  shortcut : ew
120
+
121
+- name : wikidata
122
+  engine : wikidata
123
+  shortcut : wd
124
+  timeout : 3.0
125
+  weight : 2
126
+
127
+- name : duckduckgo
128
+  engine : duckduckgo
129
+  shortcut : ddg
130
+
131
+- name : duckduckgo images
132
+  engine : duckduckgo_images
133
+  shortcut : ddi
134
+  timeout: 3.0
135
+
136
+- name : etymonline
137
+  engine : xpath
138
+  paging : True
139
+  search_url : http://etymonline.com/?search={query}&p={pageno}
140
+  url_xpath : //dt/a[1]/@href
141
+  title_xpath : //dt
142
+  content_xpath : //dd
143
+  suggestion_xpath : //a[@class="crossreference"]
144
+  first_page_num : 0
145
+  shortcut : et
146
+
147
+- name : faroo
148
+  engine : faroo
149
+  shortcut : fa
150
+
151
+- name : 500px
152
+  engine : www500px
153
+  shortcut : px
154
+
155
+- name : 1x
156
+  engine : www1x
157
+  shortcut : 1x
158
+
159
+- name : fdroid
160
+  engine : fdroid
161
+  shortcut : fd
162
+
163
+- name : findx
164
+  engine : findx
165
+  shortcut : fx
166
+  categories : general
167
+
168
+- name : findx images
169
+  engine : findx
170
+  shortcut : fxi
171
+  categories : images
172
+
173
+- name : findx videos
174
+  engine : findx
175
+  shortcut : fxv
176
+  categories : videos
177
+
178
+- name : flickr
179
+  categories : images
180
+  shortcut : fl
181
+  # You can use the engine using the official stable API, but you need an API key
182
+  # See : https://www.flickr.com/services/apps/create/
183
+  #    engine : flickr
184
+  #    api_key: 'apikey' # required!
185
+  # Or you can use the html non-stable engine, activated by default
186
+  engine : flickr_noapi
187
+
188
+- name : free software directory
189
+  engine : mediawiki
190
+  shortcut : fsd
191
+  categories : it
192
+  base_url : https://directory.fsf.org/
193
+  number_of_results : 5
194
+  # what part of a page matches the query string: title, text, nearmatch
195
+  # title - query matches title, text - query matches the text of page, nearmatch - nearmatch in title
196
+  search_type : title
197
+  timeout : 5.0
198
+
199
+- name : frinkiac
200
+  engine : frinkiac
201
+  shortcut : frk
202
+
203
+- name : genius
204
+  engine : genius
205
+  shortcut : gen
206
+
207
+- name : gigablast
208
+  engine : gigablast
209
+  shortcut : gb
210
+  timeout : 3.0
211
+
212
+- name : gitlab
213
+  engine : json_engine
214
+  paging : True
215
+  search_url : https://gitlab.com/api/v4/projects?search={query}&page={pageno}
216
+  url_query : web_url
217
+  title_query : name_with_namespace
218
+  content_query : description
219
+  page_size : 20
220
+  categories : it
221
+  shortcut : gl
222
+  timeout : 10.0
223
+
224
+- name : github
225
+  engine : github
226
+  shortcut : gh
227
+
228
+- name : google
229
+  engine : google
230
+  shortcut : go
231
+
232
+- name : google images
233
+  engine : google_images
234
+  shortcut : goi
235
+
236
+- name : google news
237
+  engine : google_news
238
+  shortcut : gon
239
+
240
+- name : google videos
241
+  engine : google_videos
242
+  shortcut : gov
243
+
244
+- name : google scholar
245
+  engine : xpath
246
+  paging : True
247
+  search_url : https://scholar.google.com/scholar?start={pageno}&q={query}&hl=en&as_sdt=0,5&as_vis=1
248
+  results_xpath : //div[@class="gs_r"]/div[@class="gs_ri"]
249
+  url_xpath : .//h3/a/@href
250
+  title_xpath : .//h3/a
251
+  content_xpath : .//div[@class="gs_rs"]
252
+  suggestion_xpath : //div[@id="gs_qsuggest"]/ul/li
253
+  page_size : 10
254
+  first_page_num : 0
255
+  categories : science
256
+  shortcut : gos
257
+
258
+- name : google play apps
259
+  engine        : xpath
260
+  search_url    : https://play.google.com/store/search?q={query}&c=apps
261
+  url_xpath     : //a[@class="title"]/@href
262
+  title_xpath   : //a[@class="title"]
263
+  content_xpath : //a[@class="subtitle"]
264
+  categories : files
265
+  shortcut : gpa
266
+
267
+- name : google play movies
268
+  engine        : xpath
269
+  search_url    : https://play.google.com/store/search?q={query}&c=movies
270
+  url_xpath     : //a[@class="title"]/@href
271
+  title_xpath   : //a[@class="title"]/@title
272
+  content_xpath : //a[contains(@class, "subtitle")]
273
+  categories : videos
274
+  shortcut : gpm
275
+
276
+- name : google play music
277
+  engine        : xpath
278
+  search_url    : https://play.google.com/store/search?q={query}&c=music
279
+  url_xpath     : //a[@class="title"]/@href
280
+  title_xpath   : //a[@class="title"]
281
+  content_xpath : //a[@class="subtitle"]
282
+  categories : music
283
+  shortcut : gps
284
+
285
+- name : geektimes
286
+  engine : xpath
287
+  paging : True
288
+  search_url : https://geektimes.ru/search/page{pageno}/?q={query}
289
+  url_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]/@href
290
+  title_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]
291
+  content_xpath : //article[contains(@class, "post")]//div[contains(@class, "post__text")]
292
+  categories : it
293
+  timeout : 4.0
294
+  shortcut : gt
295
+
296
+- name : habrahabr
297
+  engine : xpath
298
+  paging : True
299
+  search_url : https://habrahabr.ru/search/page{pageno}/?q={query}
300
+  url_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]/@href
301
+  title_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]
302
+  content_xpath : //article[contains(@class, "post")]//div[contains(@class, "post__text")]
303
+  categories : it
304
+  timeout : 4.0
305
+  shortcut : habr
306
+
307
+- name : hoogle
308
+  engine : json_engine
309
+  paging : True
310
+  search_url : https://www.haskell.org/hoogle/?mode=json&hoogle={query}&start={pageno}
311
+  results_query : results
312
+  url_query : location
313
+  title_query : self
314
+  content_query : docs
315
+  page_size : 20
316
+  categories : it
317
+  shortcut : ho
318
+
319
+- name : ina
320
+  engine : ina
321
+  shortcut : in
322
+  timeout : 6.0
323
+
324
+- name: kickass
325
+  engine : kickass
326
+  shortcut : kc
327
+  timeout : 4.0
328
+
329
+- name : library genesis
330
+  engine : xpath
331
+  search_url : http://libgen.io/search.php?req={query}
332
+  url_xpath : //a[contains(@href,"bookfi.net")]/@href
333
+  title_xpath : //a[contains(@href,"book/")]/text()[1]
334
+  content_xpath : //td/a[1][contains(@href,"=author")]/text()
335
+  categories : general
336
+  timeout : 7.0
337
+  shortcut : lg
338
+
339
+- name : lobste.rs
340
+  engine : xpath
341
+  search_url : https://lobste.rs/search?utf8=%E2%9C%93&q={query}&what=stories&order=relevance
342
+  results_xpath : //li[contains(@class, "story")]
343
+  url_xpath : .//span[@class="link"]/a/@href
344
+  title_xpath : .//span[@class="link"]/a
345
+  content_xpath : .//a[@class="domain"]
346
+  categories : it
347
+  shortcut : lo
348
+
349
+- name : microsoft academic
350
+  engine : microsoft_academic
351
+  categories : science
352
+  shortcut : ma
353
+
354
+- name : mixcloud
355
+  engine : mixcloud
356
+  shortcut : mc
357
+
358
+- name : nyaa
359
+  engine : nyaa
360
+  shortcut : nt
361
+
362
+- name : openairedatasets
363
+  engine : json_engine
364
+  paging : True
365
+  search_url : http://api.openaire.eu/search/datasets?format=json&page={pageno}&size=10&title={query}
366
+  results_query : response/results/result
367
+  url_query : metadata/oaf:entity/oaf:result/children/instance/webresource/url/$
368
+  title_query : metadata/oaf:entity/oaf:result/title/$
369
+  content_query : metadata/oaf:entity/oaf:result/description/$
370
+  categories : science
371
+  shortcut : oad
372
+  timeout: 5.0
373
+
374
+- name : openairepublications
375
+  engine : json_engine
376
+  paging : True
377
+  search_url : http://api.openaire.eu/search/publications?format=json&page={pageno}&size=10&title={query}
378
+  results_query : response/results/result
379
+  url_query : metadata/oaf:entity/oaf:result/children/instance/webresource/url/$
380
+  title_query : metadata/oaf:entity/oaf:result/title/$
381
+  content_query : metadata/oaf:entity/oaf:result/description/$
382
+  categories : science
383
+  shortcut : oap
384
+  timeout: 5.0
385
+
386
+- name : openstreetmap
387
+  engine : openstreetmap
388
+  shortcut : osm
389
+
390
+- name : openrepos
391
+  engine : xpath
392
+  paging : True
393
+  search_url : https://openrepos.net/search/node/{query}?page={pageno}
394
+  url_xpath : //li[@class="search-result"]//h3[@class="title"]/a/@href
395
+  title_xpath : //li[@class="search-result"]//h3[@class="title"]/a
396
+  content_xpath : //li[@class="search-result"]//div[@class="search-snippet-info"]//p[@class="search-snippet"]
397
+  categories : files
398
+  timeout : 4.0
399
+  shortcut : or
400
+
401
+- name : pdbe
402
+  engine : pdbe
403
+  shortcut : pdb
404
+  # Hide obsolete PDB entries.
405
+  # Default is not to hide obsolete structures
406
+  #    hide_obsolete : False
407
+
408
+- name : photon
409
+  engine : photon
410
+  shortcut : ph
411
+
412
+- name : piratebay
413
+  engine : piratebay
414
+  shortcut : tpb
415
+  url: https://pirateproxy.red/
416
+  timeout : 3.0
417
+
418
+- name : pubmed
419
+  engine : pubmed
420
+  shortcut : pub
421
+  categories: science
422
+  timeout : 3.0
423
+
424
+- name : qwant
425
+  engine : qwant
426
+  shortcut : qw
427
+  categories : general
428
+
429
+- name : qwant images
430
+  engine : qwant
431
+  shortcut : qwi
432
+  categories : images
433
+
434
+- name : qwant news
435
+  engine : qwant
436
+  shortcut : qwn
437
+  categories : news
438
+
439
+- name : qwant social
440
+  engine : qwant
441
+  shortcut : qws
442
+  categories : social media
443
+
444
+- name : reddit
445
+  engine : reddit
446
+  shortcut : re
447
+  page_size : 25
448
+  timeout : 10.0
449
+
450
+- name : scanr structures
451
+  shortcut: scs
452
+  engine : scanr_structures
453
+
454
+- name : soundcloud
455
+  engine : soundcloud
456
+  shortcut : sc
457
+
458
+- name : stackoverflow
459
+  engine : stackoverflow
460
+  shortcut : st
461
+
462
+- name : searchcode doc
463
+  engine : searchcode_doc
464
+  shortcut : scd
465
+
466
+- name : searchcode code
467
+  engine : searchcode_code
468
+  shortcut : scc
469
+
470
+- name : framalibre
471
+  engine : framalibre
472
+  shortcut : frl
473
+
474
+#  - name : searx
475
+#    engine : searx_engine
476
+#    shortcut : se
477
+#    instance_urls :
478
+#        - http://127.0.0.1:8888/
479
+#        - ...
480
+
481
+- name : semantic scholar
482
+  engine : xpath
483
+  paging : True
484
+  search_url : https://www.semanticscholar.org/search?q={query}&sort=relevance&page={pageno}&ae=false
485
+  results_xpath : //article
486
+  url_xpath : .//div[@class="search-result-title"]/a/@href
487
+  title_xpath : .//div[@class="search-result-title"]/a
488
+  content_xpath : .//div[@class="search-result-abstract"]
489
+  shortcut : se
490
+  categories : science
491
+
492
+- name : spotify
493
+  engine : spotify
494
+  shortcut : stf
495
+
496
+- name : subtitleseeker
497
+  engine : subtitleseeker
498
+  shortcut : ss
499
+  # The language is an option. You can put any language written in english
500
+  # Examples : English, French, German, Hungarian, Chinese...
501
+  #    language : English
502
+
503
+- name : startpage
504
+  engine : startpage
505
+  shortcut : sp
506
+  timeout : 6.0
507
+
508
+- name : ixquick
509
+  engine : startpage
510
+  base_url : 'https://www.ixquick.eu/'
511
+  search_url : 'https://www.ixquick.eu/do/search'
512
+  shortcut : iq
513
+  timeout : 6.0
514
+
515
+- name : swisscows
516
+  engine : swisscows
517
+  shortcut : sw
518
+
519
+- name : tokyotoshokan
520
+  engine : tokyotoshokan
521
+  shortcut : tt
522
+  timeout : 6.0
523
+
524
+- name : torrentz
525
+  engine : torrentz
526
+  shortcut : tor
527
+  url: https://torrentz2.eu/
528
+  timeout : 3.0
529
+
530
+- name : twitter
531
+  engine : twitter
532
+  shortcut : tw
533
+
534
+# maybe in a fun category
535
+#  - name : uncyclopedia
536
+#    engine : mediawiki
537
+#    shortcut : unc
538
+#    base_url : https://uncyclopedia.wikia.com/
539
+#    number_of_results : 5
540
+
541
+# tmp suspended - too slow, too many errors
542
+#  - name : urbandictionary
543
+#    engine        : xpath
544
+#    search_url    : http://www.urbandictionary.com/define.php?term={query}
545
+#    url_xpath     : //*[@class="word"]/@href
546
+#    title_xpath   : //*[@class="def-header"]
547
+#    content_xpath : //*[@class="meaning"]
548
+#    shortcut : ud
549
+
550
+- name : yahoo
551
+  engine : yahoo
552
+  shortcut : yh
553
+
554
+- name : yandex
555
+  engine : yandex
556
+  shortcut : yn
557
+
558
+- name : yahoo news
559
+  engine : yahoo_news
560
+  shortcut : yhn
561
+
562
+- name : youtube
563
+  shortcut : yt
564
+  # You can use the engine using the official stable API, but you need an API key
565
+  # See : https://console.developers.google.com/project
566
+  #    engine : youtube_api
567
+  #    api_key: 'apikey' # required!
568
+  # Or you can use the html non-stable engine, activated by default
569
+  engine : youtube_noapi
570
+
571
+- name : dailymotion
572
+  engine : dailymotion
573
+  shortcut : dm
574
+
575
+- name : vimeo
576
+  engine : vimeo
577
+  shortcut : vm
578
+
579
+- name : wolframalpha
580
+  shortcut : wa
581
+  # You can use the engine using the official stable API, but you need an API key
582
+  # See : http://products.wolframalpha.com/api/
583
+  # engine : wolframalpha_api
584
+  # api_key: '' # required!
585
+  engine : wolframalpha_noapi
586
+  timeout: 6.0
587
+  categories : science
588
+
589
+- name : seedpeer
590
+  engine : seedpeer
591
+  shortcut: speu
592
+  categories: files, music, videos
593
+
594
+- name : dictzone
595
+  engine : dictzone
596
+  shortcut : dc
597
+
598
+- name : mymemory translated
599
+  engine : translated
600
+  shortcut : tl
601
+  timeout : 5.0
602
+  # You can use without an API key, but you are limited to 1000 words/day
603
+  # See : http://mymemory.translated.net/doc/usagelimits.php
604
+  # api_key : ''
605
+
606
+- name : voat
607
+  engine: xpath
608
+  shortcut: vo
609
+  categories: social media
610
+  search_url : https://searchvoat.co/?t={query}
611
+  url_xpath : //div[@class="entry"]/p/a[@class="title"]/@href
612
+  title_xpath : //div[@class="entry"]/p/a[@class="title"]
613
+  content_xpath : //div[@class="entry"]/p/span[@class="domain"]
614
+  timeout : 10.0
615
+
616
+- name : 1337x
617
+  engine : 1337x
618
+  shortcut : 1337x
619
+
620
+#  - name : yacy
621
+#    engine : yacy
622
+#    shortcut : ya
623
+#    base_url : 'http://localhost:8090'
624
+#    number_of_results : 5
625
+#    timeout : 3.0
626
+
627
+# Doku engine lets you access to any Doku wiki instance:
628
+# A public one or a privete/corporate one.
629
+#  - name : ubuntuwiki
630
+#    engine : doku
631
+#    shortcut : uw
632
+#    base_url : 'http://doc.ubuntu-fr.org'

+ 31
- 0
searx/locales.yml Bestand weergeven

@@ -0,0 +1,31 @@
1
+  en : English
2
+  ar : العَرَبِيَّة (Arabic)
3
+  bg : Български (Bulgarian)
4
+  cs : Čeština (Czech)
5
+  da : Dansk (Danish)
6
+  de : Deutsch (German)
7
+  el_GR : Ελληνικά (Greek_Greece)
8
+  eo : Esperanto (Esperanto)
9
+  es : Español (Spanish)
10
+  fi : Suomi (Finnish)
11
+  fil : Wikang Filipino (Filipino)
12
+  fr : Français (French)
13
+  he : עברית (Hebrew)
14
+  hr : Hrvatski (Croatian)
15
+  hu : Magyar (Hungarian)
16
+  it : Italiano (Italian)
17
+  ja : 日本語 (Japanese)
18
+  nl : Nederlands (Dutch)
19
+  pl : Polszczyzna (Polish)
20
+  pt : Português (Portuguese)
21
+  pt_BR : Português (Portuguese_Brazil)
22
+  ro : Română (Romanian)
23
+  ru : Русский (Russian)
24
+  sk : Slovenčina (Slovak)
25
+  sl : Slovenski (Slovene)
26
+  sr : српски (Serbian)
27
+  sv : Svenska (Swedish)
28
+  tr : Türkçe (Turkish)
29
+  uk : українська мова (Ukrainian)
30
+  zh : 中文 (Chinese)
31
+  zh_TW : 國語 (Taiwanese Mandarin)

+ 6
- 5
searx/plugins/oa_doi_rewrite.py Bestand weergeven

@@ -11,7 +11,7 @@ description = gettext('Avoid paywalls by redirecting to open-access versions of
11 11
 default_on = False
12 12
 preference_section = 'privacy'
13 13
 
14
-doi_resolvers = settings['doi_resolvers']
14
+doi_resolvers = settings['doi']['resolvers']
15 15
 
16 16
 
17 17
 def extract_doi(url):
@@ -26,19 +26,20 @@ def extract_doi(url):
26 26
 
27 27
 
28 28
 def get_doi_resolver(args, preference_doi_resolver):
29
-    doi_resolvers = settings['doi_resolvers']
29
+    doi_resolvers = settings['doi']['resolvers']
30 30
     doi_resolver = args.get('doi_resolver', preference_doi_resolver)[0]
31 31
     if doi_resolver not in doi_resolvers:
32
-        doi_resolvers = settings['default_doi_resolver']
32
+        doi_resolver = settings['doi']['default']
33 33
     return doi_resolver
34 34
 
35 35
 
36 36
 def on_result(request, search, result):
37 37
     doi = extract_doi(result['parsed_url'])
38 38
     if doi and len(doi) < 50:
39
-        for suffix in ('/', '.pdf', '/full', '/meta', '/abstract'):
39
+        for suffix in ('/', '.pdf', '.full', '/pdf', '/full', '/meta', '/abstract'):
40 40
             if doi.endswith(suffix):
41 41
                 doi = doi[:-len(suffix)]
42
-        result['url'] = get_doi_resolver(request.args, request.preferences.get_value('doi_resolver')) + doi
42
+        base_url = doi_resolvers[get_doi_resolver(request.args, request.preferences.get_value('doi_resolver'))]
43
+        result['url'] = base_url + doi
43 44
         result['parsed_url'] = urlparse(result['url'])
44 45
     return True

+ 1
- 1
searx/preferences.py Bestand weergeven

@@ -14,7 +14,7 @@ COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5  # 5 years
14 14
 LANGUAGE_CODES = [l[0] for l in languages]
15 15
 DISABLED = 0
16 16
 ENABLED = 1
17
-DOI_RESOLVERS = list(settings['doi_resolvers'])
17
+DOI_RESOLVERS = list(settings['doi']['resolvers'])
18 18
 
19 19
 
20 20
 class MissingArgumentException(Exception):

+ 99
- 719
searx/settings.yml Bestand weergeven

@@ -6,6 +6,105 @@ search:
6 6
     safe_search : 0 # Filter results. 0: None, 1: Moderate, 2: Strict
7 7
     autocomplete : "" # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "wikipedia" - leave blank to turn it off by default
8 8
     language : "en-US"
9
+    engines_path: "" # engines.yml path - leave it blank if you don't change
10
+    include_engines_path: "" # user defined engines file path - leave it blank if you don't change
11
+    engines: # enabled engines with additional settings (timeout for example)
12
+      - name: arch linux wiki
13
+      #- name: archive is
14
+      - name: arxiv
15
+      - name: asksteem
16
+      - name: base
17
+      - name: wikipedia
18
+      - name: bing
19
+      - name: bing images
20
+      - name: bing news
21
+      - name: bing videos
22
+      #- name: bitbucket
23
+      #- name: ccc-tv
24
+      - name: crossref
25
+      - name: currency
26
+      - name: deezer
27
+      - name: deviantart
28
+      #- name: ddg definitions
29
+      #- name: digbt
30
+      - name: digg
31
+      #- name: erowid
32
+      - name: wikidata
33
+      #- name: duckduckgo
34
+      #- name: duckduckgo images
35
+      #- name: etymonline
36
+      #- name: faroo
37
+      - name: 500px
38
+      #- name: 1x
39
+      #- name: fdroid
40
+      #- name: findx
41
+      #- name: findx images
42
+      #- name: findx videos
43
+      - name: flickr
44
+      #- name: free software directory
45
+      #- name: frinkiac
46
+      - name: genius
47
+      #- name: gigablast
48
+      #- name: gitlab
49
+      - name: github
50
+      - name: google
51
+      - name: google images
52
+      - name: google news
53
+      - name: google videos
54
+      - name: google scholar
55
+      #- name: google play apps
56
+      #- name: google play movies
57
+      #- name: google play music
58
+      #- name: geektimes
59
+      #- name: habrahabr
60
+      - name: hoogle
61
+      #- name: ina
62
+      #- name: kickass
63
+      #- name: library genesis
64
+      - name: lobste.rs
65
+      - name: microsoft academic
66
+      - name: mixcloud
67
+      #- name: nyaa
68
+      - name: openairedatasets
69
+      - name: openairepublications
70
+      - name: openstreetmap
71
+      #- name: openrepos
72
+      - name: pdbe
73
+      - name: photon
74
+      - name: piratebay
75
+      - name: pubmed
76
+      #- name: qwant
77
+      - name: qwant images
78
+      - name: qwant news
79
+      - name: qwant social
80
+      #- name: reddit
81
+      #- name: scanr structures
82
+      - name: soundcloud
83
+      - name: stackoverflow
84
+      - name: searchcode doc
85
+      #- name: searchcode code
86
+      #- name: framalibre
87
+      - name: semantic scholar
88
+      - name: spotify
89
+      - name: subtitleseeker
90
+      #- name: startpage
91
+      #- name: ixquick
92
+      #- name: swisscows
93
+      #- name: tokyotoshokan
94
+      - name: torrentz
95
+      - name: twitter
96
+      #- name: yahoo
97
+      #- name: yandex
98
+      - name: yahoo news
99
+      - name: youtube
100
+      - name: dailymotion
101
+      - name: vimeo
102
+      - name: wolframalpha
103
+      #- name: seedpeer
104
+      - name: dictzone
105
+      #- name: mymemory translated
106
+      #- name: voat
107
+      #- name: 1337x
9 108
 
10 109
 server:
11 110
     port : 8888
@@ -43,722 +142,3 @@ outgoing: # communication with search engines
43 142
 #    source_ips:
44 143
 #        - 1.1.1.1
45 144
 #        - 1.1.1.2
46
-
47
-engines:
48
-  - name : arch linux wiki
49
-    engine : archlinux
50
-    shortcut : al
51
-
52
-  - name : archive is
53
-    engine : xpath
54
-    search_url : https://archive.is/{query}
55
-    url_xpath : (//div[@class="TEXT-BLOCK"]/a)/@href
56
-    title_xpath : (//div[@class="TEXT-BLOCK"]/a)
57
-    content_xpath : //div[@class="TEXT-BLOCK"]/ul/li
58
-    categories : general
59
-    timeout : 7.0
60
-    disabled : True
61
-    shortcut : ai
62
-
63
-  - name : arxiv
64
-    engine : arxiv
65
-    shortcut : arx
66
-    categories : science
67
-    timeout : 4.0
68
-
69
-  - name : asksteem
70
-    engine : asksteem
71
-    shortcut : as
72
-
73
-  - name : base
74
-    engine : base
75
-    shortcut : bs
76
-
77
-  - name : wikipedia
78
-    engine : wikipedia
79
-    shortcut : wp
80
-    base_url : 'https://{language}.wikipedia.org/'
81
-
82
-  - name : bing
83
-    engine : bing
84
-    shortcut : bi
85
-
86
-  - name : bing images
87
-    engine : bing_images
88
-    shortcut : bii
89
-
90
-  - name : bing news
91
-    engine : bing_news
92
-    shortcut : bin
93
-
94
-  - name : bing videos
95
-    engine : bing_videos
96
-    shortcut : biv
97
-
98
-  - name : bitbucket
99
-    engine : xpath
100
-    paging : True
101
-    search_url : https://bitbucket.org/repo/all/{pageno}?name={query}
102
-    url_xpath : //article[@class="repo-summary"]//a[@class="repo-link"]/@href
103
-    title_xpath : //article[@class="repo-summary"]//a[@class="repo-link"]
104
-    content_xpath : //article[@class="repo-summary"]/p
105
-    categories : it
106
-    timeout : 4.0
107
-    disabled : True
108
-    shortcut : bb
109
-
110
-  - name : ccc-tv
111
-    engine : xpath
112
-    paging : False
113
-    search_url : https://media.ccc.de/search/?q={query}
114
-    url_xpath : //div[@class="caption"]/h3/a/@href
115
-    title_xpath : //div[@class="caption"]/h3/a/text()
116
-    content_xpath : //div[@class="caption"]/h4/@title
117
-    categories : videos
118
-    disabled : True
119
-    shortcut : c3tv
120
-
121
-  - name : crossref
122
-    engine : json_engine
123
-    paging : True
124
-    search_url : http://search.crossref.org/dois?q={query}&page={pageno}
125
-    url_query : doi
126
-    title_query : title
127
-    content_query : fullCitation
128
-    categories : science
129
-    shortcut : cr
130
-
131
-  - name : currency
132
-    engine : currency_convert
133
-    categories : general
134
-    shortcut : cc
135
-
136
-  - name : deezer
137
-    engine : deezer
138
-    shortcut : dz
139
-
140
-  - name : deviantart
141
-    engine : deviantart
142
-    shortcut : da
143
-    timeout: 3.0
144
-
145
-  - name : ddg definitions
146
-    engine : duckduckgo_definitions
147
-    shortcut : ddd
148
-    weight : 2
149
-    disabled : True
150
-
151
-  - name : digbt
152
-    engine : digbt
153
-    shortcut : dbt
154
-    timeout : 6.0
155
-    disabled : True
156
-
157
-  - name : digg
158
-    engine : digg
159
-    shortcut : dg
160
-
161
-  - name : erowid
162
-    engine : xpath
163
-    paging : True
164
-    first_page_num : 0
165
-    page_size : 30
166
-    search_url : https://www.erowid.org/search.php?q={query}&s={pageno}
167
-    url_xpath : //dl[@class="results-list"]/dt[@class="result-title"]/a/@href
168
-    title_xpath : //dl[@class="results-list"]/dt[@class="result-title"]/a/text()
169
-    content_xpath : //dl[@class="results-list"]/dd[@class="result-details"]
170
-    categories : general
171
-    shortcut : ew
172
-    disabled : True
173
-
174
-  - name : wikidata
175
-    engine : wikidata
176
-    shortcut : wd
177
-    timeout : 3.0
178
-    weight : 2
179
-
180
-  - name : duckduckgo
181
-    engine : duckduckgo
182
-    shortcut : ddg
183
-    disabled : True
184
-
185
-  - name : duckduckgo images
186
-    engine : duckduckgo_images
187
-    shortcut : ddi
188
-    timeout: 3.0
189
-    disabled : True
190
-
191
-  - name : etymonline
192
-    engine : xpath
193
-    paging : True
194
-    search_url : http://etymonline.com/?search={query}&p={pageno}
195
-    url_xpath : //dt/a[1]/@href
196
-    title_xpath : //dt
197
-    content_xpath : //dd
198
-    suggestion_xpath : //a[@class="crossreference"]
199
-    first_page_num : 0
200
-    shortcut : et
201
-    disabled : True
202
-
203
-  - name : faroo
204
-    engine : faroo
205
-    shortcut : fa
206
-    disabled : True
207
-
208
-  - name : 500px
209
-    engine : www500px
210
-    shortcut : px
211
-
212
-  - name : 1x
213
-    engine : www1x
214
-    shortcut : 1x
215
-    disabled : True
216
-
217
-  - name : fdroid
218
-    engine : fdroid
219
-    shortcut : fd
220
-    disabled : True
221
-
222
-  - name : findx
223
-    engine : findx
224
-    shortcut : fx
225
-    categories : general
226
-    disabled : True
227
-
228
-  - name : findx images
229
-    engine : findx
230
-    shortcut : fxi
231
-    categories : images
232
-    disabled : True
233
-
234
-  - name : findx videos
235
-    engine : findx
236
-    shortcut : fxv
237
-    categories : videos
238
-    disabled : True
239
-
240
-  - name : flickr
241
-    categories : images
242
-    shortcut : fl
243
-# You can use the engine using the official stable API, but you need an API key
244
-# See : https://www.flickr.com/services/apps/create/
245
-#    engine : flickr
246
-#    api_key: 'apikey' # required!
247
-# Or you can use the html non-stable engine, activated by default
248
-    engine : flickr_noapi
249
-
250
-  - name : free software directory
251
-    engine : mediawiki
252
-    shortcut : fsd
253
-    categories : it
254
-    base_url : https://directory.fsf.org/
255
-    number_of_results : 5
256
-# what part of a page matches the query string: title, text, nearmatch
257
-# title - query matches title, text - query matches the text of page, nearmatch - nearmatch in title
258
-    search_type : title
259
-    timeout : 5.0
260
-    disabled : True
261
-
262
-  - name : frinkiac
263
-    engine : frinkiac
264
-    shortcut : frk
265
-    disabled : True
266
-
267
-  - name : genius
268
-    engine : genius
269
-    shortcut : gen
270
-
271
-  - name : gigablast
272
-    engine : gigablast
273
-    shortcut : gb
274
-    timeout : 3.0
275
-    disabled: True
276
-
277
-  - name : gitlab
278
-    engine : json_engine
279
-    paging : True
280
-    search_url : https://gitlab.com/api/v4/projects?search={query}&page={pageno}
281
-    url_query : web_url
282
-    title_query : name_with_namespace
283
-    content_query : description
284
-    page_size : 20
285
-    categories : it
286
-    shortcut : gl
287
-    timeout : 10.0
288
-    disabled : True
289
-
290
-  - name : github
291
-    engine : github
292
-    shortcut : gh
293
-
294
-  - name : google
295
-    engine : google
296
-    shortcut : go
297
-
298
-  - name : google images
299
-    engine : google_images
300
-    shortcut : goi
301
-
302
-  - name : google news
303
-    engine : google_news
304
-    shortcut : gon
305
-
306
-  - name : google videos
307
-    engine : google_videos
308
-    shortcut : gov
309
-
310
-  - name : google scholar
311
-    engine : xpath
312
-    paging : True
313
-    search_url : https://scholar.google.com/scholar?start={pageno}&q={query}&hl=en&as_sdt=0,5&as_vis=1
314
-    results_xpath : //div[@class="gs_r"]/div[@class="gs_ri"]
315
-    url_xpath : .//h3/a/@href
316
-    title_xpath : .//h3/a
317
-    content_xpath : .//div[@class="gs_rs"]
318
-    suggestion_xpath : //div[@id="gs_qsuggest"]/ul/li
319
-    page_size : 10
320
-    first_page_num : 0
321
-    categories : science
322
-    shortcut : gos
323
-
324
-  - name : google play apps
325
-    engine        : xpath
326
-    search_url    : https://play.google.com/store/search?q={query}&c=apps
327
-    url_xpath     : //a[@class="title"]/@href
328
-    title_xpath   : //a[@class="title"]
329
-    content_xpath : //a[@class="subtitle"]
330
-    categories : files
331
-    shortcut : gpa
332
-    disabled : True
333
-
334
-  - name : google play movies
335
-    engine        : xpath
336
-    search_url    : https://play.google.com/store/search?q={query}&c=movies
337
-    url_xpath     : //a[@class="title"]/@href
338
-    title_xpath   : //a[@class="title"]/@title
339
-    content_xpath : //a[contains(@class, "subtitle")]
340
-    categories : videos
341
-    shortcut : gpm
342
-    disabled : True
343
-
344
-  - name : google play music
345
-    engine        : xpath
346
-    search_url    : https://play.google.com/store/search?q={query}&c=music
347
-    url_xpath     : //a[@class="title"]/@href
348
-    title_xpath   : //a[@class="title"]
349
-    content_xpath : //a[@class="subtitle"]
350
-    categories : music
351
-    shortcut : gps
352
-    disabled : True
353
-
354
-  - name : geektimes
355
-    engine : xpath
356
-    paging : True
357
-    search_url : https://geektimes.ru/search/page{pageno}/?q={query}
358
-    url_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]/@href
359
-    title_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]
360
-    content_xpath : //article[contains(@class, "post")]//div[contains(@class, "post__text")]
361
-    categories : it
362
-    timeout : 4.0
363
-    disabled : True
364
-    shortcut : gt
365
-
366
-  - name : habrahabr
367
-    engine : xpath
368
-    paging : True
369
-    search_url : https://habrahabr.ru/search/page{pageno}/?q={query}
370
-    url_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]/@href
371
-    title_xpath : //article[contains(@class, "post")]//a[@class="post__title_link"]
372
-    content_xpath : //article[contains(@class, "post")]//div[contains(@class, "post__text")]
373
-    categories : it
374
-    timeout : 4.0
375
-    disabled : True
376
-    shortcut : habr
377
-
378
-  - name : hoogle
379
-    engine : json_engine
380
-    paging : True
381
-    search_url : https://www.haskell.org/hoogle/?mode=json&hoogle={query}&start={pageno}
382
-    results_query : results
383
-    url_query : location
384
-    title_query : self
385
-    content_query : docs
386
-    page_size : 20
387
-    categories : it
388
-    shortcut : ho
389
-
390
-  - name : ina
391
-    engine : ina
392
-    shortcut : in
393
-    timeout : 6.0
394
-    disabled : True
395
-
396
-  - name: kickass
397
-    engine : kickass
398
-    shortcut : kc
399
-    timeout : 4.0
400
-    disabled : True
401
-
402
-  - name : library genesis
403
-    engine : xpath
404
-    search_url : http://libgen.io/search.php?req={query}
405
-    url_xpath : //a[contains(@href,"bookfi.net")]/@href
406
-    title_xpath : //a[contains(@href,"book/")]/text()[1]
407
-    content_xpath : //td/a[1][contains(@href,"=author")]/text()
408
-    categories : general
409
-    timeout : 7.0
410
-    disabled : True
411
-    shortcut : lg
412
-
413
-  - name : lobste.rs
414
-    engine : xpath
415
-    search_url : https://lobste.rs/search?utf8=%E2%9C%93&q={query}&what=stories&order=relevance
416
-    results_xpath : //li[contains(@class, "story")]
417
-    url_xpath : .//span[@class="link"]/a/@href
418
-    title_xpath : .//span[@class="link"]/a
419
-    content_xpath : .//a[@class="domain"]
420
-    categories : it
421
-    shortcut : lo
422
-
423
-  - name : microsoft academic
424
-    engine : microsoft_academic
425
-    categories : science
426
-    shortcut : ma
427
-
428
-  - name : mixcloud
429
-    engine : mixcloud
430
-    shortcut : mc
431
-
432
-  - name : nyaa
433
-    engine : nyaa
434
-    shortcut : nt
435
-    disabled : True
436
-
437
-  - name : openairedatasets
438
-    engine : json_engine
439
-    paging : True
440
-    search_url : http://api.openaire.eu/search/datasets?format=json&page={pageno}&size=10&title={query}
441
-    results_query : response/results/result
442
-    url_query : metadata/oaf:entity/oaf:result/children/instance/webresource/url/$
443
-    title_query : metadata/oaf:entity/oaf:result/title/$
444
-    content_query : metadata/oaf:entity/oaf:result/description/$
445
-    categories : science
446
-    shortcut : oad
447
-    timeout: 5.0
448
-
449
-  - name : openairepublications
450
-    engine : json_engine
451
-    paging : True
452
-    search_url : http://api.openaire.eu/search/publications?format=json&page={pageno}&size=10&title={query}
453
-    results_query : response/results/result
454
-    url_query : metadata/oaf:entity/oaf:result/children/instance/webresource/url/$
455
-    title_query : metadata/oaf:entity/oaf:result/title/$
456
-    content_query : metadata/oaf:entity/oaf:result/description/$
457
-    categories : science
458
-    shortcut : oap
459
-    timeout: 5.0
460
-
461
-  - name : openstreetmap
462
-    engine : openstreetmap
463
-    shortcut : osm
464
-
465
-  - name : openrepos
466
-    engine : xpath
467
-    paging : True
468
-    search_url : https://openrepos.net/search/node/{query}?page={pageno}
469
-    url_xpath : //li[@class="search-result"]//h3[@class="title"]/a/@href
470
-    title_xpath : //li[@class="search-result"]//h3[@class="title"]/a
471
-    content_xpath : //li[@class="search-result"]//div[@class="search-snippet-info"]//p[@class="search-snippet"]
472
-    categories : files
473
-    timeout : 4.0
474
-    disabled : True
475
-    shortcut : or
476
-
477
-  - name : pdbe
478
-    engine : pdbe
479
-    shortcut : pdb
480
-# Hide obsolete PDB entries.
481
-# Default is not to hide obsolete structures
482
-#    hide_obsolete : False
483
-
484
-  - name : photon
485
-    engine : photon
486
-    shortcut : ph
487
-
488
-  - name : piratebay
489
-    engine : piratebay
490
-    shortcut : tpb
491
-    url: https://pirateproxy.red/
492
-    timeout : 3.0
493
-
494
-  - name : pubmed
495
-    engine : pubmed
496
-    shortcut : pub
497
-    categories: science
498
-    timeout : 3.0
499
-
500
-  - name : qwant
501
-    engine : qwant
502
-    shortcut : qw
503
-    categories : general
504
-    disabled : True
505
-
506
-  - name : qwant images
507
-    engine : qwant
508
-    shortcut : qwi
509
-    categories : images
510
-
511
-  - name : qwant news
512
-    engine : qwant
513
-    shortcut : qwn
514
-    categories : news
515
-
516
-  - name : qwant social
517
-    engine : qwant
518
-    shortcut : qws
519
-    categories : social media
520
-
521
-  - name : reddit
522
-    engine : reddit
523
-    shortcut : re
524
-    page_size : 25
525
-    timeout : 10.0
526
-    disabled : True
527
-
528
-  - name : scanr structures
529
-    shortcut: scs
530
-    engine : scanr_structures
531
-    disabled : True
532
-
533
-  - name : soundcloud
534
-    engine : soundcloud
535
-    shortcut : sc
536
-
537
-  - name : stackoverflow
538
-    engine : stackoverflow
539
-    shortcut : st
540
-
541
-  - name : searchcode doc
542
-    engine : searchcode_doc
543
-    shortcut : scd
544
-
545
-  - name : searchcode code
546
-    engine : searchcode_code
547
-    shortcut : scc
548
-    disabled : True
549
-
550
-  - name : framalibre
551
-    engine : framalibre
552
-    shortcut : frl
553
-    disabled : True
554
-
555
-#  - name : searx
556
-#    engine : searx_engine
557
-#    shortcut : se
558
-#    instance_urls :
559
-#        - http://127.0.0.1:8888/
560
-#        - ...
561
-#    disabled : True
562
-
563
-  - name : semantic scholar
564
-    engine : xpath
565
-    paging : True
566
-    search_url : https://www.semanticscholar.org/search?q={query}&sort=relevance&page={pageno}&ae=false
567
-    results_xpath : //article
568
-    url_xpath : .//div[@class="search-result-title"]/a/@href
569
-    title_xpath : .//div[@class="search-result-title"]/a
570
-    content_xpath : .//div[@class="search-result-abstract"]
571
-    shortcut : se
572
-    categories : science
573
-
574
-  - name : spotify
575
-    engine : spotify
576
-    shortcut : stf
577
-
578
-  - name : subtitleseeker
579
-    engine : subtitleseeker
580
-    shortcut : ss
581
-# The language is an option. You can put any language written in english
582
-# Examples : English, French, German, Hungarian, Chinese...
583
-#    language : English
584
-
585
-  - name : startpage
586
-    engine : startpage
587
-    shortcut : sp
588
-    timeout : 6.0
589
-    disabled : True
590
-
591
-  - name : ixquick
592
-    engine : startpage
593
-    base_url : 'https://www.ixquick.eu/'
594
-    search_url : 'https://www.ixquick.eu/do/search'
595
-    shortcut : iq
596
-    timeout : 6.0
597
-    disabled : True
598
-
599
-  - name : swisscows
600
-    engine : swisscows
601
-    shortcut : sw
602
-    disabled : True
603
-
604
-  - name : tokyotoshokan
605
-    engine : tokyotoshokan
606
-    shortcut : tt
607
-    timeout : 6.0
608
-    disabled : True
609
-
610
-  - name : torrentz
611
-    engine : torrentz
612
-    shortcut : tor
613
-    url: https://torrentz2.eu/
614
-    timeout : 3.0
615
-
616
-  - name : twitter
617
-    engine : twitter
618
-    shortcut : tw
619
-
620
-# maybe in a fun category
621
-#  - name : uncyclopedia
622
-#    engine : mediawiki
623
-#    shortcut : unc
624
-#    base_url : https://uncyclopedia.wikia.com/
625
-#    number_of_results : 5
626
-
627
-# tmp suspended - too slow, too many errors
628
-#  - name : urbandictionary
629
-#    engine        : xpath
630
-#    search_url    : http://www.urbandictionary.com/define.php?term={query}
631
-#    url_xpath     : //*[@class="word"]/@href
632
-#    title_xpath   : //*[@class="def-header"]
633
-#    content_xpath : //*[@class="meaning"]
634
-#    shortcut : ud
635
-
636
-  - name : yahoo
637
-    engine : yahoo
638
-    shortcut : yh
639
-    disabled : True
640
-
641
-  - name : yandex
642
-    engine : yandex
643
-    shortcut : yn
644
-    disabled : True
645
-
646
-  - name : yahoo news
647
-    engine : yahoo_news
648
-    shortcut : yhn
649
-
650
-  - name : youtube
651
-    shortcut : yt
652
-    # You can use the engine using the official stable API, but you need an API key
653
-    # See : https://console.developers.google.com/project
654
-    #    engine : youtube_api
655
-    #    api_key: 'apikey' # required!
656
-    # Or you can use the html non-stable engine, activated by default
657
-    engine : youtube_noapi
658
-
659
-  - name : dailymotion
660
-    engine : dailymotion
661
-    shortcut : dm
662
-
663
-  - name : vimeo
664
-    engine : vimeo
665
-    shortcut : vm
666
-
667
-  - name : wolframalpha
668
-    shortcut : wa
669
-    # You can use the engine using the official stable API, but you need an API key
670
-    # See : http://products.wolframalpha.com/api/
671
-    # engine : wolframalpha_api
672
-    # api_key: '' # required!
673
-    engine : wolframalpha_noapi
674
-    timeout: 6.0
675
-    categories : science
676
-
677
-  - name : seedpeer
678
-    engine : seedpeer
679
-    shortcut: speu
680
-    categories: files, music, videos
681
-    disabled: True
682
-
683
-  - name : dictzone
684
-    engine : dictzone
685
-    shortcut : dc
686
-
687
-  - name : mymemory translated
688
-    engine : translated
689
-    shortcut : tl
690
-    timeout : 5.0
691
-    disabled : True
692
-    # You can use without an API key, but you are limited to 1000 words/day
693
-    # See : http://mymemory.translated.net/doc/usagelimits.php
694
-    # api_key : ''
695
-
696
-  - name : voat
697
-    engine: xpath
698
-    shortcut: vo
699
-    categories: social media
700
-    search_url : https://searchvoat.co/?t={query}
701
-    url_xpath : //div[@class="entry"]/p/a[@class="title"]/@href
702
-    title_xpath : //div[@class="entry"]/p/a[@class="title"]
703
-    content_xpath : //div[@class="entry"]/p/span[@class="domain"]
704
-    timeout : 10.0
705
-    disabled : True
706
-
707
-  - name : 1337x
708
-    engine : 1337x
709
-    shortcut : 1337x
710
-    disabled : True
711
-
712
-#  - name : yacy
713
-#    engine : yacy
714
-#    shortcut : ya
715
-#    base_url : 'http://localhost:8090'
716
-#    number_of_results : 5
717
-#    timeout : 3.0
718
-
719
-# Doku engine lets you access to any Doku wiki instance:
720
-# A public one or a privete/corporate one.
721
-#  - name : ubuntuwiki
722
-#    engine : doku
723
-#    shortcut : uw
724
-#    base_url : 'http://doc.ubuntu-fr.org'
725
-
726
-locales:
727
-    en : English
728
-    ar : العَرَبِيَّة (Arabic)
729
-    bg : Български (Bulgarian)
730
-    cs : Čeština (Czech)
731
-    da : Dansk (Danish)
732
-    de : Deutsch (German)
733
-    el_GR : Ελληνικά (Greek_Greece)
734
-    eo : Esperanto (Esperanto)
735
-    es : Español (Spanish)
736
-    fi : Suomi (Finnish)
737
-    fil : Wikang Filipino (Filipino)
738
-    fr : Français (French)
739
-    he : עברית (Hebrew)
740
-    hr : Hrvatski (Croatian)
741
-    hu : Magyar (Hungarian)
742
-    it : Italiano (Italian)
743
-    ja : 日本語 (Japanese)
744
-    nl : Nederlands (Dutch)
745
-    pl : Polszczyzna (Polish)
746
-    pt : Português (Portuguese)
747
-    pt_BR : Português (Portuguese_Brazil)
748
-    ro : Română (Romanian)
749
-    ru : Русский (Russian)
750
-    sk : Slovenčina (Slovak)
751
-    sl : Slovenski (Slovene)
752
-    sr : српски (Serbian)
753
-    sv : Svenska (Swedish)
754
-    tr : Türkçe (Turkish)
755
-    uk : українська мова (Ukrainian)
756
-    zh : 中文 (Chinese)
757
-    zh_TW : 國語 (Taiwanese Mandarin)
758
-
759
-doi_resolvers :
760
-  oadoi.org : 'https://oadoi.org/'
761
-  doi.org : 'https://doi.org/'
762
-  doai.io  : 'http://doai.io/'
763
-
764
-default_doi_resolver : 'oadoi.org'

+ 3
- 3
searx/webapp.py Bestand weergeven

@@ -716,7 +716,7 @@ def preferences():
716 716
                   shortcuts={y: x for x, y in engine_shortcuts.items()},
717 717
                   themes=themes,
718 718
                   plugins=plugins,
719
-                  doi_resolvers=settings['doi_resolvers'],
719
+                  doi_resolvers=settings['doi']['resolvers'],
720 720
                   current_doi_resolver=get_doi_resolver(request.args, request.preferences.get_value('doi_resolver')),
721 721
                   allowed_plugins=allowed_plugins,
722 722
                   theme=get_current_theme_name(),
@@ -863,8 +863,8 @@ def config():
863 863
                     'safe_search': settings['search']['safe_search'],
864 864
                     'default_theme': settings['ui']['default_theme'],
865 865
                     'version': VERSION_STRING,
866
-                    'doi_resolvers': [r for r in settings['doi_resolvers']],
867
-                    'default_doi_resolver': settings['default_doi_resolver'],
866
+                    'doi_resolvers': [r for r in settings['doi']['resolvers']],
867
+                    'default_doi_resolver': settings['doi']['default'],
868 868
                     })
869 869
 
870 870