From 6ff57dfbe1b9c011b7bb3f0fce967fad70e5ca72 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Tue, 4 Mar 2014 18:53:56 +0100 Subject: [PATCH 1/9] [enh] linkable search url display --- searx/static/css/style.css | 2 ++ searx/templates/results.html | 4 ++++ searx/webapp.py | 1 + 3 files changed, 7 insertions(+) diff --git a/searx/static/css/style.css b/searx/static/css/style.css index a99e4cda..4b2d3c36 100644 --- a/searx/static/css/style.css +++ b/searx/static/css/style.css @@ -165,6 +165,8 @@ tr:hover { background: #DDDDDD; } #suggestions span { display: block; margin: 0 2px 2px 2px; padding: 0; } #suggestions form { display: block; } #suggestions input { padding: 2px 6px; margin: 2px 4px; font-size: 0.8em; display: inline-block; background: #3498DB; color: #FFFFFF; border-radius: 4px; border: 0; cursor: pointer; } +#search_url { margin-top: 8px; } +#search_url input { border: 1px solid #888888; padding: 4px; color: #444444; width: 20em; display: block; margin: 4px; } #preferences { top: 10px; diff --git a/searx/templates/results.html b/searx/templates/results.html index 34195c86..9efb6ea4 100644 --- a/searx/templates/results.html +++ b/searx/templates/results.html @@ -18,6 +18,10 @@ {% endif %} +
+ {{ _('Search URL') }}: + +
{{ _('Download results') }} {% for output_type in ('csv', 'json', 'rss') %} diff --git a/searx/webapp.py b/searx/webapp.py index 4dbfcd6c..ab6d522c 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -182,6 +182,7 @@ def index(): selected_categories=search.categories, paging=search.paging, pageno=search.pageno, + base_url=get_base_url(), suggestions=search.suggestions ) From c2951e16a5c74358af0defb67e82510f8ec26aca Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Tue, 4 Mar 2014 19:25:59 +0100 Subject: [PATCH 2/9] [fix] search url categories --- searx/templates/results.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searx/templates/results.html b/searx/templates/results.html index 9efb6ea4..73265083 100644 --- a/searx/templates/results.html +++ b/searx/templates/results.html @@ -20,7 +20,7 @@
{{ _('Search URL') }}: - +
{{ _('Download results') }} From 693415c78707a2bb01bc952bd977292cc67a7f26 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Tue, 4 Mar 2014 19:26:09 +0100 Subject: [PATCH 3/9] [fix] pep8 --- searx/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/searx/utils.py b/searx/utils.py index b99a945d..1e48e37e 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -10,6 +10,7 @@ ua_versions = ('26.0', '27.0', '28.0') ua_os = ('Windows NT 6.3; WOW64', 'X11; Linux x86_64; rv:26.0') ua = "Mozilla/5.0 ({os}) Gecko/20100101 Firefox/{version}" + def gen_useragent(): # TODO return ua.format(os=choice(ua_os), version=choice(ua_versions)) From 6f535b6fae878c1fb8520c944156c7dc4b81228d Mon Sep 17 00:00:00 2001 From: potato Date: Tue, 4 Mar 2014 19:43:41 +0100 Subject: [PATCH 4/9] [fix] error when xpath_results in extraxt_text is _ElementUnicodeResult instead of _ElementStringResult --- searx/engines/xpath.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 9af24de3..72120304 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -1,7 +1,7 @@ from lxml import html from urllib import urlencode, unquote from urlparse import urlparse, urljoin -from lxml.etree import _ElementStringResult +from lxml.etree import _ElementStringResult, _ElementUnicodeResult from searx.utils import html_to_text search_url = None @@ -29,7 +29,7 @@ def extract_text(xpath_results): for e in xpath_results: result = result + extract_text(e) return result - elif type(xpath_results) == _ElementStringResult: + elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]: # it's a string return ''.join(xpath_results) else: From a4f89a798196f7d0c8a72ca80b34d2e9b6c040d5 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Tue, 4 Mar 2014 20:31:03 +0100 Subject: [PATCH 5/9] [fix] proper src/href url handling --- searx/templates/about.html | 6 +++--- searx/templates/base.html | 6 +++--- searx/templates/github_ribbon.html | 2 +- searx/templates/index.html | 4 ++-- searx/templates/preferences.html | 4 ++-- searx/templates/results.html | 12 ++++++------ searx/templates/search.html | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/searx/templates/about.html b/searx/templates/about.html index 1fb15c2d..c2ba7f5a 100644 --- a/searx/templates/about.html +++ b/searx/templates/about.html @@ -2,9 +2,9 @@ {% block content %} {% include 'github_ribbon.html' %}
-

About searx

+

About searx

-

Searx is a metasearch engine, aggregating the results of other search engines while not storing information about its users. +

Searx is a metasearch engine, aggregating the results of other search engines while not storing information about its users.

Why use Searx?

    @@ -60,7 +60,7 @@ Searx can be added to your browser's search bar; moreover, it can be set as the

    See the installation and setup wiki page

    How to debug engines?

    -

    Stats page contains some useful data about the engines used.

    +

    Stats page contains some useful data about the engines used.

{% endblock %} diff --git a/searx/templates/base.html b/searx/templates/base.html index 683ed4ed..d1892245 100644 --- a/searx/templates/base.html +++ b/searx/templates/base.html @@ -6,19 +6,19 @@ {% block title %}{% endblock %}searx - + {% block styles %} {% endblock %} {% block head %} - + {% endblock %}
{% block content %} {% endblock %} - +
diff --git a/searx/templates/github_ribbon.html b/searx/templates/github_ribbon.html index 92862f6b..bdd9cf18 100644 --- a/searx/templates/github_ribbon.html +++ b/searx/templates/github_ribbon.html @@ -1,3 +1,3 @@ - Fork me on GitHub + Fork me on GitHub diff --git a/searx/templates/index.html b/searx/templates/index.html index 18320ae0..57b67ef0 100644 --- a/searx/templates/index.html +++ b/searx/templates/index.html @@ -4,8 +4,8 @@

searx

{% include 'search.html' %}

- {{ _('about') }} - {{ _('preferences') }} + {{ _('about') }} + {{ _('preferences') }}

{% endblock %} diff --git a/searx/templates/preferences.html b/searx/templates/preferences.html index dc33c5df..5632accd 100644 --- a/searx/templates/preferences.html +++ b/searx/templates/preferences.html @@ -4,7 +4,7 @@

{{ _('Preferences') }}

-
+
{{ _('Default categories') }}

@@ -66,6 +66,6 @@

- +
{% endblock %} diff --git a/searx/templates/results.html b/searx/templates/results.html index 73265083..8094e96b 100644 --- a/searx/templates/results.html +++ b/searx/templates/results.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block title %}{{ q }} - {% endblock %} {% block content %} - + @@ -10,8 +10,8 @@ {% if suggestions %}
{{ _('Suggestions') }} {% for suggestion in suggestions %} -
- + +
{% endfor %} @@ -25,7 +25,7 @@
{{ _('Download results') }} {% for output_type in ('csv', 'json', 'rss') %} -
+
@@ -52,7 +52,7 @@ {% if paging %}