diff --git a/AUTHORS.rst b/AUTHORS.rst index 7e97c48c2..b57160df3 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -60,3 +60,6 @@ generally made searx better: - Pydo ``_ - Athemis ``_ - Stefan Antoni `` +- @firebovine +- Lorenzo J. Lucchini @luccoj +- @eig8phei diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 999570eb5..741b5397f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,32 @@ +0.11.0 2017.01.10 +================= + +- New engines + + - Protein Data Bank Europe (science) + - Voat.co (general, social media) + - Online Etimology Dictionary (science) + - CCC tv (video, it) + - Searx (all categories - can rotate multiple other instances) +- Answerer functionality (see answerer section on /preferences) +- Local answerers + + - Statistical functions + - Random value generator +- Result proxy support (with `morty `__) +- Extended time range filter +- Improved search language support +- Multiple engine fixes (digbt, 500px, google news, ixquick, bing, kickass, google play movies, habrahabr, yandex) +- Minor UI improvements +- Suggestion support for JSON engine +- Result and query escaping fixes +- Configurable HTTP server version +- More robust search error handling +- Faster webapp initialization in debug mode +- Search module refactor +- Translation updates + + 0.10.0 2016.09.06 ================= diff --git a/requirements.txt b/requirements.txt index d6c91b246..ac6a2c9f9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,6 @@ flask-babel==0.11.1 lxml==3.7.1 ndg-httpsclient==0.4.2 pyasn1==0.1.9 -pyasn1-modules==0.0.8 pygments==2.1.3 pyopenssl==16.2.0 python-dateutil==2.5.3 diff --git a/searx/engines/1337x.py b/searx/engines/1337x.py new file mode 100644 index 000000000..c6bc3cb6d --- /dev/null +++ b/searx/engines/1337x.py @@ -0,0 +1,40 @@ +from urllib import quote +from lxml import html +from searx.engines.xpath import extract_text +from searx.utils import get_torrent_size +from urlparse import urljoin + +url = 'https://1337x.to/' +search_url = url + 'search/{search_term}/{pageno}/' +categories = ['videos'] +paging = True + + +def request(query, params): + params['url'] = search_url.format(search_term=quote(query), pageno=params['pageno']) + + return params + + +def response(resp): + results = [] + + dom = html.fromstring(resp.text) + + for result in dom.xpath('//table[contains(@class, "table-list")]/tbody//tr'): + href = urljoin(url, result.xpath('./td[contains(@class, "name")]/a[2]/@href')[0]) + title = extract_text(result.xpath('./td[contains(@class, "name")]/a[2]')) + seed = extract_text(result.xpath('.//td[contains(@class, "seeds")]')) + leech = extract_text(result.xpath('.//td[contains(@class, "leeches")]')) + filesize_info = extract_text(result.xpath('.//td[contains(@class, "size")]/text()')) + filesize, filesize_multiplier = filesize_info.split() + filesize = get_torrent_size(filesize, filesize_multiplier) + + results.append({'url': href, + 'title': title, + 'seed': seed, + 'leech': leech, + 'filesize': filesize, + 'template': 'torrent.html'}) + + return results diff --git a/searx/engines/google.py b/searx/engines/google.py index 803cd307e..2fa638d73 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -217,6 +217,10 @@ def response(resp): # convert the text to dom dom = html.fromstring(resp.text) + instant_answer = dom.xpath('//div[@id="_vBb"]//text()') + if instant_answer: + results.append({'answer': u' '.join(instant_answer)}) + # parse results for result in dom.xpath(results_xpath): try: diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 49c6a5d50..6b79ff5c8 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -66,11 +66,14 @@ def response(resp): # parse results for result in dom.xpath('//div[@class="g"]|//div[@class="g _cy"]'): - r = { - 'url': result.xpath('.//div[@class="_cnc"]//a/@href')[0], - 'title': ''.join(result.xpath('.//div[@class="_cnc"]//h3//text()')), - 'content': ''.join(result.xpath('.//div[@class="st"]//text()')), - } + try: + r = { + 'url': result.xpath('.//div[@class="_cnc"]//a/@href')[0], + 'title': ''.join(result.xpath('.//div[@class="_cnc"]//h3//text()')), + 'content': ''.join(result.xpath('.//div[@class="st"]//text()')), + } + except: + continue imgs = result.xpath('.//img/@src') if len(imgs) and not imgs[0].startswith('data'): diff --git a/searx/query.py b/searx/query.py index 4a4e5a192..66e38711c 100644 --- a/searx/query.py +++ b/searx/query.py @@ -95,7 +95,7 @@ class RawTextQuery(object): # this force a engine or category if query_part[0] == '!' or query_part[0] == '?': - prefix = query_part[1:].replace('-', ' ') + prefix = query_part[1:].replace('-', ' ').replace('_', ' ') # check if prefix is equal with engine shortcut if prefix in engine_shortcuts: diff --git a/searx/settings.yml b/searx/settings.yml index a475433a9..549b2b31d 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -588,6 +588,10 @@ engines: timeout : 10.0 disabled : True + - name : 1337x + engine : 1337x + shortcut : 1337x + disabled : True #The blekko technology and team have joined IBM Watson! -> https://blekko.com/ # - name : blekko images @@ -612,6 +616,7 @@ engines: locales: en : English bg : Български (Bulgarian) + cs : Čeština (Czech) de : Deutsch (German) el_GR : Ελληνικά (Greek_Greece) eo : Esperanto (Esperanto) @@ -626,5 +631,6 @@ locales: pt_BR : Português (Portuguese_Brazil) ro : Română (Romanian) ru : Русский (Russian) + sv : Svenska (Swedish) tr : Türkçe (Turkish) zh : 中文 (Chinese) diff --git a/searx/static/themes/oscar/img/icons/1337x.png b/searx/static/themes/oscar/img/icons/1337x.png new file mode 100644 index 000000000..1fde5f248 Binary files /dev/null and b/searx/static/themes/oscar/img/icons/1337x.png differ diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html index 0ae83e74b..f5e95438d 100644 --- a/searx/templates/oscar/results.html +++ b/searx/templates/oscar/results.html @@ -1,6 +1,15 @@ {% extends "oscar/base.html" %} +{% macro search_form_attrs() -%} + {% for category in selected_categories %}{% endfor %} + + + + +{%- endmacro %} +{%- macro search_url() %}{{ base_url }}?q={{ q|urlencode }}{% if selected_categories %}&categories={{ selected_categories|join(",") | replace(' ','+') }}{% endif %}{% if pageno > 1 %}&pageno={{ pageno }}{% endif %}{% if time_range %}&time_range={{ time_range }}{% endif %}{% if current_language != 'all' %}&language={{ current_language }}{% endif %}{% endmacro -%} + {% block title %}{{ q|e }} - {% endblock %} -{% block meta %}{% endblock %} +{% block meta %}{% endblock %} {% block content %}
@@ -36,20 +45,14 @@ {% if rtl %}