on master help sign in
Merge branch 'master' of https://github.com/asciimoo/searx into add-docs
51b9295Markus Heiser
docs/admin/installation.rst+15−7
@@ -114,6 +114,9 @@ content:
114 # Module to import
114 # Module to import
115 module = searx.webapp
115 module = searx.webapp
116
116
117+ # Support running the module from a webserver subdirectory.
118+ route-run = fixpathinfo:
119+
117 # Virtualenv and python path
120 # Virtualenv and python path
118 virtualenv = /usr/local/searx/searx-ve/
121 virtualenv = /usr/local/searx/searx-ve/
119 pythonpath = /usr/local/searx/
122 pythonpath = /usr/local/searx/
@@ -151,7 +154,10 @@ content:
151 server {
154 server {
152 listen 80;
155 listen 80;
153 server_name searx.example.com;
156 server_name searx.example.com;
154− root /usr/local/searx;
157+ root /usr/local/searx/searx;
158+
159+ location /static {
160+ }
155
161
156 location / {
162 location / {
157 include uwsgi_params;
163 include uwsgi_params;
@@ -180,14 +186,13 @@ Add this configuration in the server config file
180
186
181.. code:: nginx
187.. code:: nginx
182
188
183− location = /searx { rewrite ^ /searx/; }
189+ location /searx/static {
184− location /searx {
190+ alias /usr/local/searx/searx/static;
185− try_files $uri @searx;
186 }
191 }
192+
187− location @searx {
193+ location /searx {
188 uwsgi_param SCRIPT_NAME /searx;
194 uwsgi_param SCRIPT_NAME /searx;
189 include uwsgi_params;
195 include uwsgi_params;
190− uwsgi_modifier1 30;
191 uwsgi_pass unix:/run/uwsgi/app/searx/socket;
196 uwsgi_pass unix:/run/uwsgi/app/searx/socket;
192 }
197 }
193
198
@@ -197,6 +202,10 @@ in case of single-user or low-traffic instances.)
197
202
198.. code:: nginx
203.. code:: nginx
199
204
205+ location /searx/static {
206+ alias /usr/local/searx/searx/static;
207+ }
208+
200 location /searx {
209 location /searx {
201 proxy_pass http://127.0.0.1:8888;
210 proxy_pass http://127.0.0.1:8888;
202 proxy_set_header Host $host;
211 proxy_set_header Host $host;
@@ -338,4 +347,3 @@ References
338
347
339* How to: `Setup searx in a couple of hours with a free SSL certificate
348* How to: `Setup searx in a couple of hours with a free SSL certificate
340 <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__
349 <https://www.reddit.com/r/privacytoolsIO/comments/366kvn/how_to_setup_your_own_privacy_respecting_search/>`__
341−
searx/engines/bing.py+2−3
@@ -89,8 +89,7 @@ def response(resp):
89 'content': content})
89 'content': content})
90
90
91 try:
91 try:
92− result_len_container = "".join(eval_xpath(dom, '//span[@class="sb_count"]/text()'))
92+ result_len_container = "".join(eval_xpath(dom, '//span[@class="sb_count"]//text()'))
93− result_len_container = utils.to_string(result_len_container)
94 if "-" in result_len_container:
93 if "-" in result_len_container:
95 # Remove the part "from-to" for paginated request ...
94 # Remove the part "from-to" for paginated request ...
96 result_len_container = result_len_container[result_len_container.find("-") * 2 + 2:]
95 result_len_container = result_len_container[result_len_container.find("-") * 2 + 2:]
@@ -102,7 +101,7 @@ def response(resp):
102 logger.debug('result error :\n%s', e)
101 logger.debug('result error :\n%s', e)
103 pass
102 pass
104
103
105− if _get_offset_from_pageno(resp.search_params.get("pageno", 0)) > result_len:
104+ if result_len and _get_offset_from_pageno(resp.search_params.get("pageno", 0)) > result_len:
106 return []
105 return []
107
106
108 results.append({'number_of_results': result_len})
107 results.append({'number_of_results': result_len})
searx/engines/flickr_noapi.py+17−9
@@ -109,14 +109,22 @@ def response(resp):
109 else:
109 else:
110 url = build_flickr_url(photo['ownerNsid'], photo['id'])
110 url = build_flickr_url(photo['ownerNsid'], photo['id'])
111
111
112+ result = {
112− results.append({'url': url,
113+ 'url': url,
113− 'title': title,
114− 'img_src': img_src,
114+ 'img_src': img_src,
115− 'thumbnail_src': thumbnail_src,
115+ 'thumbnail_src': thumbnail_src,
116− 'content': content,
117− 'author': author,
118− 'source': source,
116+ 'source': source,
119− 'img_format': img_format,
117+ 'img_format': img_format,
120− 'template': 'images.html'})
118+ 'template': 'images.html'
119+ }
120+ try:
121+ result['author'] = author.encode('utf-8')
122+ result['title'] = title.encode('utf-8')
123+ result['content'] = content.encode('utf-8')
124+ except:
125+ result['author'] = ''
126+ result['title'] = ''
127+ result['content'] = ''
128+ results.append(result)
121
129
122 return results
130 return results
searx/engines/ina.py+6−3
@@ -32,7 +32,7 @@ base_url = 'https://www.ina.fr'
32search_url = base_url + '/layout/set/ajax/recherche/result?autopromote=&hf={ps}&b={start}&type=Video&r=&{query}'
32search_url = base_url + '/layout/set/ajax/recherche/result?autopromote=&hf={ps}&b={start}&type=Video&r=&{query}'
33
33
34# specific xpath variables
34# specific xpath variables
35−results_xpath = '//div[contains(@class,"search-results--list")]/div[@class="media"]'
35+results_xpath = '//div[contains(@class,"search-results--list")]//div[@class="media-body"]'
36url_xpath = './/a/@href'
36url_xpath = './/a/@href'
37title_xpath = './/h3[@class="h3--title media-heading"]'
37title_xpath = './/h3[@class="h3--title media-heading"]'
38thumbnail_xpath = './/img/@src'
38thumbnail_xpath = './/img/@src'
@@ -65,8 +65,11 @@ def response(resp):
65 videoid = result.xpath(url_xpath)[0]
65 videoid = result.xpath(url_xpath)[0]
66 url = base_url + videoid
66 url = base_url + videoid
67 title = p.unescape(extract_text(result.xpath(title_xpath)))
67 title = p.unescape(extract_text(result.xpath(title_xpath)))
68+ try:
68− thumbnail = extract_text(result.xpath(thumbnail_xpath)[0])
69+ thumbnail = extract_text(result.xpath(thumbnail_xpath)[0])
70+ except:
71+ thumbnail = ''
69− if thumbnail[0] == '/':
72+ if thumbnail and thumbnail[0] == '/':
70 thumbnail = base_url + thumbnail
73 thumbnail = base_url + thumbnail
71 d = extract_text(result.xpath(publishedDate_xpath)[0])
74 d = extract_text(result.xpath(publishedDate_xpath)[0])
72 d = d.split('/')
75 d = d.split('/')
searx/engines/microsoft_academic.py+2
@@ -45,6 +45,8 @@ def request(query, params):
45def response(resp):
45def response(resp):
46 results = []
46 results = []
47 response_data = loads(resp.text)
47 response_data = loads(resp.text)
48+ if not response_data:
49+ return results
48
50
49 for result in response_data['results']:
51 for result in response_data['results']:
50 url = _get_url(result)
52 url = _get_url(result)
searx/engines/scanr_structures.py+1−1
@@ -29,7 +29,7 @@ def request(query, params):
29 params['url'] = search_url
29 params['url'] = search_url
30 params['method'] = 'POST'
30 params['method'] = 'POST'
31 params['headers']['Content-type'] = "application/json"
31 params['headers']['Content-type'] = "application/json"
32− params['data'] = dumps({"query": query,
32+ params['data'] = dumps({"query": query.decode('utf-8'),
33 "searchField": "ALL",
33 "searchField": "ALL",
34 "sortDirection": "ASC",
34 "sortDirection": "ASC",
35 "sortOrder": "RELEVANCY",
35 "sortOrder": "RELEVANCY",
searx/settings.yml+9−7
@@ -79,9 +79,10 @@ engines:
79 categories : science
79 categories : science
80 timeout : 4.0
80 timeout : 4.0
81
81
82+# tmp suspended: dh key too small
82− - name : base
83+# - name : base
83− engine : base
84+# engine : base
84− shortcut : bs
85+# shortcut : bs
85
86
86 - name : wikipedia
87 - name : wikipedia
87 engine : wikipedia
88 engine : wikipedia
@@ -552,10 +553,11 @@ engines:
552 timeout : 10.0
553 timeout : 10.0
553 disabled : True
554 disabled : True
554
555
556+# tmp suspended: bad certificate
555− - name : scanr structures
557+# - name : scanr structures
556− shortcut: scs
558+# shortcut: scs
557− engine : scanr_structures
559+# engine : scanr_structures
558− disabled : True
560+# disabled : True
559
561
560 - name : soundcloud
562 - name : soundcloud
561 engine : soundcloud
563 engine : soundcloud