summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/duckduckgo.py6
-rw-r--r--searx/engines/yacy.py2
-rw-r--r--searx/templates/__common__/about.html14
-rw-r--r--searx/templates/oscar/base.html4
-rw-r--r--searx/templates/oscar/macros.html26
-rw-r--r--searx/templates/oscar/result_templates/code.html4
-rw-r--r--searx/templates/oscar/result_templates/default.html10
-rw-r--r--searx/templates/oscar/result_templates/images.html4
-rw-r--r--searx/templates/oscar/result_templates/map.html8
-rw-r--r--searx/templates/oscar/result_templates/torrent.html8
-rw-r--r--searx/templates/oscar/result_templates/videos.html12
11 files changed, 54 insertions, 44 deletions
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 0d2c0af2d..6e07b5021 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -50,6 +50,7 @@ result_xpath = '//div[@class="result results_links results_links_deep web-result
url_xpath = './/a[@class="result__a"]/@href'
title_xpath = './/a[@class="result__a"]'
content_xpath = './/a[@class="result__snippet"]'
+correction_xpath = '//div[@id="did_you_mean"]//a'
# match query's language to a region code that duckduckgo will accept
@@ -125,6 +126,11 @@ def response(resp):
'content': content,
'url': res_url})
+ # parse correction
+ for correction in eval_xpath(doc, correction_xpath):
+ # append correction
+ results.append({'correction': extract_text(correction)})
+
# return results
return results
diff --git a/searx/engines/yacy.py b/searx/engines/yacy.py
index 25bc83687..f1d4c6abe 100644
--- a/searx/engines/yacy.py
+++ b/searx/engines/yacy.py
@@ -75,7 +75,7 @@ def response(resp):
for result in search_results[0].get('items', []):
# parse image results
- if result.get('image'):
+ if result.get('image') and result.get('width') and result.get('height'):
result_url = ''
if 'url' in result:
diff --git a/searx/templates/__common__/about.html b/searx/templates/__common__/about.html
index d3e8d06a6..9741b5162 100644
--- a/searx/templates/__common__/about.html
+++ b/searx/templates/__common__/about.html
@@ -59,12 +59,16 @@
<h2 id='add to browser'>How to set as the default search engine?</h2>
- <dt>Firefox</dt>
+ <p>
+ Searx supports <a href="https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md">OpenSearch</a>.
+ For more information on changing your default search engine, see your browser's documentation:
+ </p>
- <dd>
- <a href="#" onclick="window.external.AddSearchProvider(window.location.protocol + '//' + window.location.host + '{{ url_for('opensearch') }}');">Install</a>
- searx as a search engine on any version of Firefox! (javascript required)
- </dd>
+ <ul>
+ <li><a href="https://support.mozilla.org/en-US/kb/add-or-remove-search-engine-firefox">Firefox</a></li>
+ <li><a href="https://support.microsoft.com/en-us/help/4028574/microsoft-edge-change-the-default-search-engine" >Microsoft Egde</a></li>
+ <li>Chrome based browsers <a href="https://www.chromium.org/tab-to-search">only add websites that the user navigates to without a path.</a>
+ </ul>
<h2>Where to find anonymous usage statistics of this instance ?</h2>
diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html
index 2ccadd700..a3bfa5249 100644
--- a/searx/templates/oscar/base.html
+++ b/searx/templates/oscar/base.html
@@ -8,7 +8,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="searx/{{ searx_version }}">
<meta name="referrer" content="no-referrer">
- <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=1.0, user-scalable=1" />
+ <meta name="viewport" content="width=device-width, initial-scale=1 , maximum-scale=2.0, user-scalable=1" />
{% block meta %}{% endblock %}
<script src="{{ url_for('js_translations') }}"></script>
<title>{% block title %}{% endblock %}{{ instance_name }}</title>
@@ -42,7 +42,7 @@
<style type="text/css">
.tab-content > .active_if_nojs, .active_if_nojs {display: block !important; visibility: visible !important;}
.margin_top_if_nojs {margin-top: 20px;}
- .hide_if_nojs {display: none !important;overflow:none !important;}
+ .hide_if_nojs {display: none !important;overflow: hidden !important;}
.disabled_if_nojs {pointer-events: none; cursor: default; text-decoration: line-through;}
</style>
</noscript>
diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html
index 809c9f595..58f966997 100644
--- a/searx/templates/oscar/macros.html
+++ b/searx/templates/oscar/macros.html
@@ -8,34 +8,34 @@
<img width="32" height="32" class="favicon" src="{{ url_for('static', filename='themes/oscar/img/icons/' + favicon + '.png') }}" alt="{{ favicon }}" />
{%- endmacro %}
-{%- macro result_link(url, title, classes='') -%}
-<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ title }}</a>
+{%- macro result_link(url, title, classes='', id='') -%}
+<a href="{{ url }}" {% if classes %}class="{{ classes }}" {% endif %}{% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}{% if id %} aria-labelledby="result-{{id}}"{%endif%}>{{ title }}</a>
{%- endmacro -%}
<!-- Draw result header -->
-{% macro result_header(result, favicons) -%}
-<h4 class="result_header">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
+{% macro result_header(result, favicons, id) -%}
+<h4 class="result_header" id="result-{{id}}">{% if result.engine~".png" in favicons %}{{ draw_favicon(result.engine) }} {% endif %}{% if result.url %}{{ result_link(result.url, result.title|safe, id=id) }}{% else %}{{ result.title|safe}}{% endif %}</h4>
{%- endmacro %}
<!-- Draw result sub header -->
-{% macro result_sub_header(result) -%}
+{% macro result_sub_header(result, id) -%}
{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
- {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink") }}</small>{% endif %}
- {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile") }}</small>{% endif %}
+ {% if result.magnetlink %}<small> &bull; {{ result_link(result.magnetlink, icon('magnet') + _('magnet link'), "magnetlink", id) }}</small>{% endif %}
+ {% if result.torrentfile %}<small> &bull; {{ result_link(result.torrentfile, icon('download-alt') + _('torrent file'), "torrentfile", id) }}</small>{% endif %}
{%- endmacro %}
<!-- Draw result footer -->
-{% macro result_footer(result) -%}
+{% macro result_footer(result, id) -%}
<div class="clearfix"></div>{{- "" -}}
<div class="pull-right">
{%- for engine in result.engines -%}
<span class="label label-default">{{ engine }}</span>
{%- endfor -%}
{%- if result.url -%}
- <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
+ <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
{%- endif -%}
{%- if proxify -%}
- <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
+ <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small>
{%- endif -%}
</div>
{%- if result.pretty_url -%}
@@ -44,16 +44,16 @@
{%- endmacro %}
<!-- Draw result footer -->
-{% macro result_footer_rtl(result) -%}
+{% macro result_footer_rtl(result, id) -%}
<div class="clearfix"></div>{{- "" -}}
{% for engine in result.engines -%}
<span class="label label-default">{{ engine }}</span>
{%- endfor %}
{%- if result.url -%}
- <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info") }}</small>
+ <small>{{ result_link("https://web.archive.org/web/" + result.url, icon('link') + _('cached'), "text-info", id) }}</small>
{%- endif -%}
{% if proxify -%}
- <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info") }}</small>
+ <small>{{ result_link(proxify(result.url), icon('sort') + _('proxied'), "text-info", id) }}</small>
{%- endif %}
{%- if result.pretty_url -%}
<div class="external-link">{{ result.pretty_url }}</div>
diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html
index a1c18a6b7..c7d93e2b3 100644
--- a/searx/templates/oscar/result_templates/code.html
+++ b/searx/templates/oscar/result_templates/code.html
@@ -1,11 +1,11 @@
-{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context%}
{{ result_header(result, favicons) }}
{{ result_sub_header(result) }}
{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
-{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}>{{ result.repository }}</a></p>{% endif %}
+{% if result.repository %}<p class="result-content">{{ icon('file') }} <a href="{{ result.repository }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} aria-labelledby="result-{{loop.index}}">{{ result.repository }}</a></p>{% endif %}
<div dir="ltr">
{{ result.codelines|code_highlighter(result.code_language)|safe }}
diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html
index 57365f34e..bc71d190d 100644
--- a/searx/templates/oscar/result_templates/default.html
+++ b/searx/templates/oscar/result_templates/default.html
@@ -1,10 +1,10 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon with context %}
-{{- result_header(result, favicons) -}}
-{{- result_sub_header(result) -}}
+{{- result_header(result, favicons, loop.index) -}}
+{{- result_sub_header(result, loop.index) -}}
{%- if result.embedded -%}
- <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}">{{ icon('music') }} {{ _('show media') }}</a></small>
+ <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-media-{{ index }}" data-btn-text-collapsed="{{ _('show media') }}" data-btn-text-not-collapsed="{{ _('hide media') }}" aria-labelledby="result-{{loop.index}}">{{ icon('music') }} {{ _('show media') }}</a></small>
{%- endif -%}
{%- if result.embedded -%}
@@ -25,7 +25,7 @@
{%- endif -%}
{%- if rtl -%}
-{{ result_footer_rtl(result) }}
+{{ result_footer_rtl(result, loop.index) }}
{%- else -%}
-{{ result_footer(result) }}
+{{ result_footer(result, loop.index) }}
{%- endif -%}
diff --git a/searx/templates/oscar/result_templates/images.html b/searx/templates/oscar/result_templates/images.html
index d0a3b7b83..96cdd53bb 100644
--- a/searx/templates/oscar/result_templates/images.html
+++ b/searx/templates/oscar/result_templates/images.html
@@ -1,6 +1,6 @@
-{%- from 'oscar/macros.html' import draw_favicon -%}
+{%- from 'oscar/macros.html' import draw_favicon with context -%}
-<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}">{{- "" -}}
+<a href="{{ result.img_src }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %} data-toggle="modal" data-target="#modal-{{ index }}-{{pageno}}" id="result-{{loop.index}}">{{- "" -}}
<img src="{% if result.thumbnail_src %}{{ image_proxify(result.thumbnail_src) }}{% else %}{{ image_proxify(result.img_src) }}{% endif %}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">{{- "" -}}
</a>
<div class="modal fade" id="modal-{{ index }}-{{ pageno }}" tabindex="-1" role="dialog" aria-hidden="true">{{- "" -}}
diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html
index 712375d7f..be34d65d0 100644
--- a/searx/templates/oscar/result_templates/map.html
+++ b/searx/templates/oscar/result_templates/map.html
@@ -1,7 +1,7 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
-{{ result_header(result, favicons) }}
-{{ result_sub_header(result) }}
+{{ result_header(result, favicons, loop.index) }}
+{{ result_sub_header(result, loop.index) }}
{% if (result.latitude and result.longitude) or result.boundingbox %}
<small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer disabled_if_nojs" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
@@ -66,7 +66,7 @@
{% endif %}
{% if rtl %}
-{{ result_footer_rtl(result) }}
+{{ result_footer_rtl(result, loop.index) }}
{% else %}
-{{ result_footer(result) }}
+{{ result_footer(result, loop.index) }}
{% endif %}
diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html
index 089367e36..0bba61417 100644
--- a/searx/templates/oscar/result_templates/torrent.html
+++ b/searx/templates/oscar/result_templates/torrent.html
@@ -1,7 +1,7 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
-{{ result_header(result, favicons) }}
-{{ result_sub_header(result) }}
+{{ result_header(result, favicons, loop.index) }}
+{{ result_sub_header(result, loop.index) }}
{% if result.seed is defined %}<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span> &bull; {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>{% endif %}
{% if result.filesize %}<br />{{ icon('floppy-disk') }} {{ _('Filesize') }}
@@ -19,7 +19,7 @@
</p>
{% if rtl %}
-{{ result_footer_rtl(result) }}
+{{ result_footer_rtl(result, loop.index) }}
{% else %}
-{{ result_footer(result) }}
+{{ result_footer(result, loop.index) }}
{% endif %}
diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html
index 6d9101d2e..bf02a553a 100644
--- a/searx/templates/oscar/result_templates/videos.html
+++ b/searx/templates/oscar/result_templates/videos.html
@@ -1,10 +1,10 @@
{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %}
-{{ result_header(result, favicons) }}
-{{ result_sub_header(result) }}
+{{ result_header(result, favicons, loop.index) }}
+{{ result_sub_header(result, loop.index) }}
{% if result.embedded %}
- <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}">{{ icon('film') }} {{ _('show video') }}</a></small>
+ <small> &bull; <a class="text-info btn-collapse collapsed cursor-pointer media-loader disabled_if_nojs" data-toggle="collapse" data-target="#result-video-{{ index }}" data-btn-text-collapsed="{{ _('show video') }}" data-btn-text-not-collapsed="{{ _('hide video') }}" aria-labelledby="result-{{loop.index}}">{{ icon('film') }} {{ _('show video') }}</a></small>
{% endif %}
{% if result.embedded %}
@@ -15,7 +15,7 @@
<div class="container-fluid">
<div class="row">
- <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" /></a>
+ <a href="{{ result.url }}" {% if results_on_new_tab %}target="_blank" rel="noopener noreferrer"{% else %}rel="noreferrer"{% endif %}><img class="thumbnail col-xs-6 col-sm-4 col-md-4 result-content" src="{{ image_proxify(result.thumbnail) }}" aria-labelledby="result-{{loop.index}}" /></a>
{% if result.author %}<p class="col-xs-12 col-sm-8 col-md-8 result-content"><b>{{ _('Author') }}</b>: {{ result.author }}</p>{% endif %}
{% if result.length %}<p class="col-xs-12 col-sm-8 col-md-8 result-content"><b>{{ _('Length') }}</b>: {{ result.length }}</p>{% endif %}
{% if result.content %}<p class="col-xs-12 col-sm-8 col-md-8 result-content">{{ result.content|safe }}</p>{% endif %}
@@ -23,7 +23,7 @@
</div>
{% if rtl %}
-{{ result_footer_rtl(result) }}
+{{ result_footer_rtl(result, loop.index) }}
{% else %}
-{{ result_footer(result) }}
+{{ result_footer(result, loop.index) }}
{% endif %}