diff --git a/AUTHORS.rst b/AUTHORS.rst index 311c97781..906a0bfd6 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -26,3 +26,4 @@ generally made searx better: - dp - Martin Zimmermann - @courgette +- @kernc diff --git a/searx/__init__.py b/searx/__init__.py index 17da2f353..46685817a 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -17,6 +17,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. from os import environ from os.path import realpath, dirname, join, abspath +from searx.https_rewrite import load_https_rules try: from yaml import load except: @@ -27,14 +28,24 @@ except: searx_dir = abspath(dirname(__file__)) engine_dir = dirname(realpath(__file__)) -# if possible set path to settings using the enviroment variable SEARX_SETTINGS_PATH +# if possible set path to settings using the +# enviroment variable SEARX_SETTINGS_PATH if 'SEARX_SETTINGS_PATH' in environ: settings_path = environ['SEARX_SETTINGS_PATH'] # otherwise using default path else: settings_path = join(searx_dir, 'settings.yml') +if 'SEARX_HTTPS_REWRITE_PATH' in environ: + https_rewrite_path = environ['SEARX_HTTPS_REWRITE_PATH'] +else: + https_rewrite_path = join(searx_dir, 'https_rules') # load settings with open(settings_path) as settings_yaml: settings = load(settings_yaml) + +# load https rules only if https rewrite is enabled +if settings.get('server', {}).get('https_rewrite'): + # loade https rules + load_https_rules(https_rewrite_path) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index e63dd7189..80356a8cd 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -41,7 +41,7 @@ def load_module(filename): module.name = modname return module -if not 'engines' in settings or not settings['engines']: +if 'engines' not in settings or not settings['engines']: print '[E] Error no engines found. Edit your settings.yml' exit(2) @@ -68,15 +68,15 @@ for engine_data in settings['engines']: engine.categories = ['general'] if not hasattr(engine, 'language_support'): - #engine.language_support = False + # engine.language_support = False engine.language_support = True if not hasattr(engine, 'timeout'): - #engine.language_support = False + # engine.language_support = False engine.timeout = settings['server']['request_timeout'] if not hasattr(engine, 'shortcut'): - #engine.shortcut = ''' + # engine.shortcut = ''' engine.shortcut = '' # checking required variables @@ -161,7 +161,8 @@ def get_engines_stats(): for engine in scores_per_result: if max_score_per_result: - engine['percentage'] = int(engine['avg'] / max_score_per_result * 100) + engine['percentage'] = int(engine['avg'] + / max_score_per_result * 100) else: engine['percentage'] = 0 diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index 3da7352a4..c008f22f7 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -116,15 +116,22 @@ def response(resp): if len(heading)>0: # TODO get infobox.meta.value where .label='article_title' - results.append({ - 'infobox': heading, - 'id': infobox_id, - 'entity': entity, - 'content': content, - 'img_src' : image, - 'attributes': attributes, - 'urls': urls, - 'relatedTopics': relatedTopics - }) + if image==None and len(attributes)==0 and len(urls)==1 and len(relatedTopics)==0 and len(content)==0: + results.append({ + 'url': urls[0]['url'], + 'title': heading, + 'content': content + }) + else: + results.append({ + 'infobox': heading, + 'id': infobox_id, + 'entity': entity, + 'content': content, + 'img_src' : image, + 'attributes': attributes, + 'urls': urls, + 'relatedTopics': relatedTopics + }) return results diff --git a/searx/engines/faroo.py b/searx/engines/faroo.py new file mode 100644 index 000000000..8c69c5bee --- /dev/null +++ b/searx/engines/faroo.py @@ -0,0 +1,108 @@ +## Faroo (Web, News) +# +# @website http://www.faroo.com +# @provide-api yes (http://www.faroo.com/hp/api/api.html), require API-key +# +# @using-api yes +# @results JSON +# @stable yes +# @parse url, title, content, publishedDate, img_src + +from urllib import urlencode +from json import loads +import datetime +from searx.utils import searx_useragent + +# engine dependent config +categories = ['general', 'news'] +paging = True +language_support = True +number_of_results = 10 +api_key = None + +# search-url +url = 'http://www.faroo.com/' +search_url = url + 'api?{query}&start={offset}&length={number_of_results}&l={language}&src={categorie}&i=false&f=json&key={api_key}' + +search_category = {'general': 'web', + 'news': 'news'} + +# do search-request +def request(query, params): + offset = (params['pageno']-1) * number_of_results + 1 + categorie = search_category.get(params['category'], 'web') + + if params['language'] == 'all': + language = 'en' + else: + language = params['language'].split('_')[0] + + # skip, if language is not supported + if language != 'en' and\ + language != 'de' and\ + language != 'zh': + return params + + params['url'] = search_url.format(offset=offset, + number_of_results=number_of_results, + query=urlencode({'q': query}), + language=language, + categorie=categorie, + api_key=api_key ) + + # using searx User-Agent + params['headers']['User-Agent'] = searx_useragent() + + return params + + +# get response from search-request +def response(resp): + # HTTP-Code 401: api-key is not valide + if resp.status_code == 401: + raise Exception("API key is not valide") + return [] + + # HTTP-Code 429: rate limit exceeded + if resp.status_code == 429: + raise Exception("rate limit has been exceeded!") + return [] + + results = [] + + search_res = loads(resp.text) + + # return empty array if there are no results + if not search_res.get('results', {}): + return [] + + # parse results + for result in search_res['results']: + if result['news']: + # timestamp (how many milliseconds have passed between now and the beginning of 1970) + publishedDate = datetime.datetime.fromtimestamp(result['date']/1000.0) + + # append news result + results.append({'url': result['url'], + 'title': result['title'], + 'publishedDate': publishedDate, + 'content': result['kwic']}) + + else: + # append general result + # TODO, publishedDate correct? + results.append({'url': result['url'], + 'title': result['title'], + 'content': result['kwic']}) + + # append image result if image url is set + # TODO, show results with an image like in faroo + if result['iurl']: + results.append({'template': 'images.html', + 'url': result['url'], + 'title': result['title'], + 'content': result['kwic'], + 'img_src': result['iurl']}) + + # return results + return results diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py index 8c8e7f219..7877e1198 100644 --- a/searx/engines/wikidata.py +++ b/searx/engines/wikidata.py @@ -2,7 +2,7 @@ import json from requests import get from urllib import urlencode -resultCount=2 +resultCount=1 urlSearch = 'https://www.wikidata.org/w/api.php?action=query&list=search&format=json&srnamespace=0&srprop=sectiontitle&{query}' urlDetail = 'https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&props=labels%7Cinfo%7Csitelinks%7Csitelinks%2Furls%7Cdescriptions%7Cclaims&{query}' urlMap = 'https://www.openstreetmap.org/?lat={latitude}&lon={longitude}&zoom={zoom}&layers=M' @@ -33,17 +33,20 @@ def response(resp): return results def getDetail(jsonresponse, wikidata_id, language): - result = jsonresponse.get('entities', {}).get(wikidata_id, {}) - - title = result.get('labels', {}).get(language, {}).get('value', None) - if title == None: - title = result.get('labels', {}).get('en', {}).get('value', wikidata_id) results = [] urls = [] attributes = [] - description = result.get('descriptions', {}).get(language, {}).get('value', '') - if description == '': + result = jsonresponse.get('entities', {}).get(wikidata_id, {}) + + title = result.get('labels', {}).get(language, {}).get('value', None) + if title == None: + title = result.get('labels', {}).get('en', {}).get('value', None) + if title == None: + return results + + description = result.get('descriptions', {}).get(language, {}).get('value', None) + if description == None: description = result.get('descriptions', {}).get('en', {}).get('value', '') claims = result.get('claims', {}) @@ -52,10 +55,15 @@ def getDetail(jsonresponse, wikidata_id, language): urls.append({ 'title' : 'Official site', 'url': official_website }) results.append({ 'title': title, 'url' : official_website }) + wikipedia_link_count = 0 if language != 'en': - add_url(urls, 'Wikipedia (' + language + ')', get_wikilink(result, language + 'wiki')) + wikipedia_link_count += add_url(urls, 'Wikipedia (' + language + ')', get_wikilink(result, language + 'wiki')) wikipedia_en_link = get_wikilink(result, 'enwiki') - add_url(urls, 'Wikipedia (en)', wikipedia_en_link) + wikipedia_link_count += add_url(urls, 'Wikipedia (en)', wikipedia_en_link) + if wikipedia_link_count == 0: + misc_language = get_wiki_firstlanguage(result, 'wiki') + if misc_language != None: + add_url(urls, 'Wikipedia (' + misc_language + ')', get_wikilink(result, misc_language + 'wiki')) if language != 'en': add_url(urls, 'Wiki voyage (' + language + ')', get_wikilink(result, language + 'wikivoyage')) @@ -105,14 +113,20 @@ def getDetail(jsonresponse, wikidata_id, language): if date_of_death != None: attributes.append({'label' : 'Date of death', 'value' : date_of_death}) - - results.append({ - 'infobox' : title, - 'id' : wikipedia_en_link, - 'content' : description, - 'attributes' : attributes, - 'urls' : urls - }) + if len(attributes)==0 and len(urls)==2 and len(description)==0: + results.append({ + 'url': urls[0]['url'], + 'title': title, + 'content': description + }) + else: + results.append({ + 'infobox' : title, + 'id' : wikipedia_en_link, + 'content' : description, + 'attributes' : attributes, + 'urls' : urls + }) return results @@ -120,7 +134,9 @@ def getDetail(jsonresponse, wikidata_id, language): def add_url(urls, title, url): if url != None: urls.append({'title' : title, 'url' : url}) - + return 1 + else: + return 0 def get_mainsnak(claims, propertyName): propValue = claims.get(propertyName, {}) @@ -147,7 +163,8 @@ def get_string(claims, propertyName, defaultValue=None): if len(result) == 0: return defaultValue else: - return ', '.join(result) + #TODO handle multiple urls + return result[0] def get_time(claims, propertyName, defaultValue=None): @@ -213,3 +230,9 @@ def get_wikilink(result, wikiid): elif url.startswith('//'): url = 'https:' + url return url + +def get_wiki_firstlanguage(result, wikipatternid): + for k in result.get('sitelinks', {}).keys(): + if k.endswith(wikipatternid) and len(k)==(2+len(wikipatternid)): + return k[0:2] + return None diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py index c07d7e185..4a7dd16ea 100644 --- a/searx/engines/yahoo_news.py +++ b/searx/engines/yahoo_news.py @@ -1,8 +1,9 @@ -## Yahoo (News) -# +# Yahoo (News) +# # @website https://news.yahoo.com -# @provide-api yes (https://developer.yahoo.com/boss/search/), $0.80/1000 queries -# +# @provide-api yes (https://developer.yahoo.com/boss/search/) +# $0.80/1000 queries +# # @using-api no (because pricing) # @results HTML (using search portal) # @stable no (HTML can change) @@ -22,7 +23,7 @@ paging = True language_support = True # search-url -search_url = 'https://news.search.yahoo.com/search?{query}&b={offset}&fl=1&vl=lang_{lang}' +search_url = 'https://news.search.yahoo.com/search?{query}&b={offset}&fl=1&vl=lang_{lang}' # noqa # specific xpath variables results_xpath = '//div[@class="res"]' @@ -41,7 +42,7 @@ def request(query, params): language = 'en' else: language = params['language'].split('_')[0] - + params['url'] = search_url.format(offset=offset, query=urlencode({'p': query}), lang=language) diff --git a/searx/engines/youtube.py b/searx/engines/youtube.py index e217fb079..7d1c207f0 100644 --- a/searx/engines/youtube.py +++ b/searx/engines/youtube.py @@ -13,7 +13,7 @@ from urllib import urlencode from dateutil import parser # engine dependent config -categories = ['videos'] +categories = ['videos', 'music'] paging = True language_support = True diff --git a/searx/https_rewrite.py b/searx/https_rewrite.py index 44ada9450..9faf3599d 100644 --- a/searx/https_rewrite.py +++ b/searx/https_rewrite.py @@ -1,14 +1,145 @@ +''' +searx is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +searx is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with searx. If not, see < http://www.gnu.org/licenses/ >. + +(C) 2013- by Adam Tauber, +''' + import re +from lxml import etree +from os import listdir +from os.path import isfile, isdir, join + # https://gitweb.torproject.org/\ # pde/https-everywhere.git/tree/4.0:/src/chrome/content/rules # HTTPS rewrite rules -https_rules = ( - # from - (re.compile(r'^http://(www\.|m\.|)?xkcd\.(?:com|org)/', re.I | re.U), - # to - r'https://\1xkcd.com/'), - (re.compile(r'^https?://(?:ssl)?imgs\.xkcd\.com/', re.I | re.U), - r'https://sslimgs.xkcd.com/'), -) +https_rules = [] + + +# load single ruleset from a xml file +def load_single_https_ruleset(filepath): + ruleset = () + + # init parser + parser = etree.XMLParser() + + # load and parse xml-file + try: + tree = etree.parse(filepath, parser) + except: + # TODO, error message + return () + + # get root node + root = tree.getroot() + + # check if root is a node with the name ruleset + # TODO improve parsing + if root.tag != 'ruleset': + return () + + # check if rule is deactivated by default + if root.attrib.get('default_off'): + return () + + # check if rule does only work for specific platforms + if root.attrib.get('platform'): + return () + + hosts = [] + rules = [] + exclusions = [] + + # parse childs from ruleset + for ruleset in root: + # this child define a target + if ruleset.tag == 'target': + # check if required tags available + if not ruleset.attrib.get('host'): + continue + + # convert host-rule to valid regex + host = ruleset.attrib.get('host')\ + .replace('.', '\.').replace('*', '.*') + + # append to host list + hosts.append(host) + + # this child define a rule + elif ruleset.tag == 'rule': + # check if required tags available + if not ruleset.attrib.get('from')\ + or not ruleset.attrib.get('to'): + continue + + # TODO hack, which convert a javascript regex group + # into a valid python regex group + rule_from = ruleset.attrib.get('from').replace('$', '\\') + rule_to = ruleset.attrib.get('to').replace('$', '\\') + + # TODO, not working yet because of the hack above, + # currently doing that in webapp.py + # rule_from_rgx = re.compile(rule_from, re.I) + + # append rule + rules.append((rule_from, rule_to)) + + # this child define an exclusion + elif ruleset.tag == 'exclusion': + # check if required tags available + if not ruleset.attrib.get('pattern'): + continue + + exclusion_rgx = re.compile(ruleset.attrib.get('pattern')) + + # append exclusion + exclusions.append(exclusion_rgx) + + # convert list of possible hosts to a simple regex + # TODO compress regex to improve performance + try: + target_hosts = re.compile('^(' + '|'.join(hosts) + ')', re.I | re.U) + except: + return () + + # return ruleset + return (target_hosts, rules, exclusions) + + +# load all https rewrite rules +def load_https_rules(rules_path): + # check if directory exists + if not isdir(rules_path): + print("[E] directory not found: '" + rules_path + "'") + return + + # search all xml files which are stored in the https rule directory + xml_files = [join(rules_path, f) + for f in listdir(rules_path) + if isfile(join(rules_path, f)) and f[-4:] == '.xml'] + + # load xml-files + for ruleset_file in xml_files: + # calculate rewrite-rules + ruleset = load_single_https_ruleset(ruleset_file) + + # skip if no ruleset returned + if not ruleset: + continue + + # append ruleset + https_rules.append(ruleset) + + print(' * {n} https-rules loaded'.format(n=len(https_rules))) diff --git a/searx/https_rules/00README b/searx/https_rules/00README new file mode 100644 index 000000000..fcd8a7724 --- /dev/null +++ b/searx/https_rules/00README @@ -0,0 +1,17 @@ + diff --git a/searx/https_rules/Bing.xml b/searx/https_rules/Bing.xml new file mode 100644 index 000000000..8b403f108 --- /dev/null +++ b/searx/https_rules/Bing.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Dailymotion.xml b/searx/https_rules/Dailymotion.xml new file mode 100644 index 000000000..743100cb7 --- /dev/null +++ b/searx/https_rules/Dailymotion.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Deviantart.xml b/searx/https_rules/Deviantart.xml new file mode 100644 index 000000000..7830fc20f --- /dev/null +++ b/searx/https_rules/Deviantart.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/DuckDuckGo.xml b/searx/https_rules/DuckDuckGo.xml new file mode 100644 index 000000000..173a9ad9f --- /dev/null +++ b/searx/https_rules/DuckDuckGo.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Flickr.xml b/searx/https_rules/Flickr.xml new file mode 100644 index 000000000..85c6e8065 --- /dev/null +++ b/searx/https_rules/Flickr.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Github-Pages.xml b/searx/https_rules/Github-Pages.xml new file mode 100644 index 000000000..d3be58a4c --- /dev/null +++ b/searx/https_rules/Github-Pages.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/searx/https_rules/Github.xml b/searx/https_rules/Github.xml new file mode 100644 index 000000000..a9a3a1e53 --- /dev/null +++ b/searx/https_rules/Github.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Google-mismatches.xml b/searx/https_rules/Google-mismatches.xml new file mode 100644 index 000000000..de9d3eb18 --- /dev/null +++ b/searx/https_rules/Google-mismatches.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Google.org.xml b/searx/https_rules/Google.org.xml new file mode 100644 index 000000000..d6cc47881 --- /dev/null +++ b/searx/https_rules/Google.org.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/searx/https_rules/GoogleAPIs.xml b/searx/https_rules/GoogleAPIs.xml new file mode 100644 index 000000000..85a5a8081 --- /dev/null +++ b/searx/https_rules/GoogleAPIs.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleCanada.xml b/searx/https_rules/GoogleCanada.xml new file mode 100644 index 000000000..d5eefe816 --- /dev/null +++ b/searx/https_rules/GoogleCanada.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/searx/https_rules/GoogleImages.xml b/searx/https_rules/GoogleImages.xml new file mode 100644 index 000000000..0112001e0 --- /dev/null +++ b/searx/https_rules/GoogleImages.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleMainSearch.xml b/searx/https_rules/GoogleMainSearch.xml new file mode 100644 index 000000000..df504d90c --- /dev/null +++ b/searx/https_rules/GoogleMainSearch.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleMaps.xml b/searx/https_rules/GoogleMaps.xml new file mode 100644 index 000000000..0f82c5267 --- /dev/null +++ b/searx/https_rules/GoogleMaps.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleMelange.xml b/searx/https_rules/GoogleMelange.xml new file mode 100644 index 000000000..ec23cd45f --- /dev/null +++ b/searx/https_rules/GoogleMelange.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/searx/https_rules/GoogleSearch.xml b/searx/https_rules/GoogleSearch.xml new file mode 100644 index 000000000..66b7ffdb0 --- /dev/null +++ b/searx/https_rules/GoogleSearch.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleServices.xml b/searx/https_rules/GoogleServices.xml new file mode 100644 index 000000000..704646b53 --- /dev/null +++ b/searx/https_rules/GoogleServices.xml @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleShopping.xml b/searx/https_rules/GoogleShopping.xml new file mode 100644 index 000000000..6ba69a91d --- /dev/null +++ b/searx/https_rules/GoogleShopping.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleSorry.xml b/searx/https_rules/GoogleSorry.xml new file mode 100644 index 000000000..72a19210d --- /dev/null +++ b/searx/https_rules/GoogleSorry.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/searx/https_rules/GoogleTranslate.xml b/searx/https_rules/GoogleTranslate.xml new file mode 100644 index 000000000..a004025ae --- /dev/null +++ b/searx/https_rules/GoogleTranslate.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/searx/https_rules/GoogleVideos.xml b/searx/https_rules/GoogleVideos.xml new file mode 100644 index 000000000..a5e88fcf0 --- /dev/null +++ b/searx/https_rules/GoogleVideos.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/GoogleWatchBlog.xml b/searx/https_rules/GoogleWatchBlog.xml new file mode 100644 index 000000000..afec70c97 --- /dev/null +++ b/searx/https_rules/GoogleWatchBlog.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/searx/https_rules/Google_App_Engine.xml b/searx/https_rules/Google_App_Engine.xml new file mode 100644 index 000000000..851e051d1 --- /dev/null +++ b/searx/https_rules/Google_App_Engine.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/searx/https_rules/Googleplex.com.xml b/searx/https_rules/Googleplex.com.xml new file mode 100644 index 000000000..7ddbb5ba9 --- /dev/null +++ b/searx/https_rules/Googleplex.com.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/searx/https_rules/OpenStreetMap.xml b/searx/https_rules/OpenStreetMap.xml new file mode 100644 index 000000000..58a661823 --- /dev/null +++ b/searx/https_rules/OpenStreetMap.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/searx/https_rules/Rawgithub.com.xml b/searx/https_rules/Rawgithub.com.xml new file mode 100644 index 000000000..3868f332a --- /dev/null +++ b/searx/https_rules/Rawgithub.com.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/searx/https_rules/Soundcloud.xml b/searx/https_rules/Soundcloud.xml new file mode 100644 index 000000000..0baa5832b --- /dev/null +++ b/searx/https_rules/Soundcloud.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/ThePirateBay.xml b/searx/https_rules/ThePirateBay.xml new file mode 100644 index 000000000..010387b6b --- /dev/null +++ b/searx/https_rules/ThePirateBay.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Torproject.xml b/searx/https_rules/Torproject.xml new file mode 100644 index 000000000..69269af7e --- /dev/null +++ b/searx/https_rules/Torproject.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Twitter.xml b/searx/https_rules/Twitter.xml new file mode 100644 index 000000000..3285f44e0 --- /dev/null +++ b/searx/https_rules/Twitter.xml @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Vimeo.xml b/searx/https_rules/Vimeo.xml new file mode 100644 index 000000000..f2a3e5764 --- /dev/null +++ b/searx/https_rules/Vimeo.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/WikiLeaks.xml b/searx/https_rules/WikiLeaks.xml new file mode 100644 index 000000000..977709d2d --- /dev/null +++ b/searx/https_rules/WikiLeaks.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/searx/https_rules/Wikimedia.xml b/searx/https_rules/Wikimedia.xml new file mode 100644 index 000000000..9f25831a2 --- /dev/null +++ b/searx/https_rules/Wikimedia.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/Yahoo.xml b/searx/https_rules/Yahoo.xml new file mode 100644 index 000000000..33548c4ab --- /dev/null +++ b/searx/https_rules/Yahoo.xml @@ -0,0 +1,2450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/https_rules/YouTube.xml b/searx/https_rules/YouTube.xml new file mode 100644 index 000000000..bddc2a5f3 --- /dev/null +++ b/searx/https_rules/YouTube.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/searx/query.py b/searx/query.py index 612d46f4b..9f711e982 100644 --- a/searx/query.py +++ b/searx/query.py @@ -31,30 +31,31 @@ class Query(object): def __init__(self, query, blocked_engines): self.query = query self.blocked_engines = [] - + if blocked_engines: self.blocked_engines = blocked_engines - + self.query_parts = [] self.engines = [] self.languages = [] - - # parse query, if tags are set, which change the serch engine or search-language + + # parse query, if tags are set, which + # change the serch engine or search-language def parse_query(self): self.query_parts = [] - + # split query, including whitespaces raw_query_parts = re.split(r'(\s+)', self.query) - + parse_next = True - + for query_part in raw_query_parts: if not parse_next: self.query_parts[-1] += query_part continue - + parse_next = False - + # part does only contain spaces, skip if query_part.isspace()\ or query_part == '': @@ -62,15 +63,17 @@ class Query(object): self.query_parts.append(query_part) continue - # this force a language + # this force a language if query_part[0] == ':': lang = query_part[1:].lower() - # check if any language-code is equal with declared language-codes + # check if any language-code is equal with + # declared language-codes for lc in language_codes: lang_id, lang_name, country = map(str.lower, lc) - # if correct language-code is found, set it as new search-language + # if correct language-code is found + # set it as new search-language if lang == lang_id\ or lang_id.startswith(lang)\ or lang == lang_name\ @@ -89,23 +92,24 @@ class Query(object): parse_next = True self.engines.append({'category': 'none', 'name': engine_shortcuts[prefix]}) - + # check if prefix is equal with engine name elif prefix in engines\ - and not prefix in self.blocked_engines: + and prefix not in self.blocked_engines: parse_next = True self.engines.append({'category': 'none', 'name': prefix}) # check if prefix is equal with categorie name elif prefix in categories: - # using all engines for that search, which are declared under that categorie name + # using all engines for that search, which + # are declared under that categorie name parse_next = True self.engines.extend({'category': prefix, 'name': engine.name} for engine in categories[prefix] - if not engine in self.blocked_engines) - + if engine not in self.blocked_engines) + # append query part to query_part list self.query_parts.append(query_part) @@ -114,14 +118,13 @@ class Query(object): self.query_parts[-1] = search_query else: self.query_parts.append(search_query) - + def getSearchQuery(self): if len(self.query_parts): return self.query_parts[-1] else: return '' - + def getFullQuery(self): # get full querry including whitespaces return string.join(self.query_parts, '') - diff --git a/searx/search.py b/searx/search.py index 0aa9d500a..f051d6df2 100644 --- a/searx/search.py +++ b/searx/search.py @@ -22,7 +22,7 @@ from datetime import datetime from operator import itemgetter from urlparse import urlparse, unquote from searx.engines import ( - categories, engines, engine_shortcuts + categories, engines ) from searx.languages import language_codes from searx.utils import gen_useragent @@ -39,7 +39,13 @@ def default_request_params(): # create a callback wrapper for the search engine results -def make_callback(engine_name, results, suggestions, answers, infoboxes, callback, params): +def make_callback(engine_name, + results, + suggestions, + answers, + infoboxes, + callback, + params): # creating a callback wrapper for the search engine results def process_callback(response, **kwargs): @@ -95,7 +101,7 @@ def make_callback(engine_name, results, suggestions, answers, infoboxes, callbac def content_result_len(content): if isinstance(content, basestring): content = re.sub('[,;:!?\./\\\\ ()-_]', '', content) - return len(content) + return len(content) else: return 0 @@ -126,7 +132,8 @@ def score_results(results): # strip multiple spaces and cariage returns from content if 'content' in res: - res['content'] = re.sub(' +', ' ', res['content'].strip().replace('\n', '')) + res['content'] = re.sub(' +', ' ', + res['content'].strip().replace('\n', '')) # get weight of this engine if possible if hasattr(engines[res['engine']], 'weight'): @@ -139,8 +146,12 @@ def score_results(results): duplicated = False for new_res in results: # remove / from the end of the url if required - p1 = res['parsed_url'].path[:-1] if res['parsed_url'].path.endswith('/') else res['parsed_url'].path # noqa - p2 = new_res['parsed_url'].path[:-1] if new_res['parsed_url'].path.endswith('/') else new_res['parsed_url'].path # noqa + p1 = res['parsed_url'].path[:-1]\ + if res['parsed_url'].path.endswith('/')\ + else res['parsed_url'].path + p2 = new_res['parsed_url'].path[:-1]\ + if new_res['parsed_url'].path.endswith('/')\ + else new_res['parsed_url'].path # check if that result is a duplicate if res['host'] == new_res['host'] and\ @@ -153,7 +164,8 @@ def score_results(results): # merge duplicates together if duplicated: # using content with more text - if content_result_len(res.get('content', '')) > content_result_len(duplicated.get('content', '')): + if content_result_len(res.get('content', '')) >\ + content_result_len(duplicated.get('content', '')): duplicated['content'] = res['content'] # increase result-score @@ -182,17 +194,25 @@ def score_results(results): for i, res in enumerate(results): # FIXME : handle more than one category per engine - category = engines[res['engine']].categories[0] + ':' + '' if 'template' not in res else res['template'] + category = engines[res['engine']].categories[0] + ':' + ''\ + if 'template' not in res\ + else res['template'] - current = None if category not in categoryPositions else categoryPositions[category] + current = None if category not in categoryPositions\ + else categoryPositions[category] - # group with previous results using the same category if the group can accept more result and is not too far from the current position - if current != None and (current['count'] > 0) and (len(gresults) - current['index'] < 20): - # group with the previous results using the same category with this one + # group with previous results using the same category + # if the group can accept more result and is not too far + # from the current position + if current is not None and (current['count'] > 0)\ + and (len(gresults) - current['index'] < 20): + # group with the previous results using + # the same category with this one index = current['index'] gresults.insert(index, res) - # update every index after the current one (including the current one) + # update every index after the current one + # (including the current one) for k in categoryPositions: v = categoryPositions[k]['index'] if v >= index: @@ -206,7 +226,7 @@ def score_results(results): gresults.append(res) # update categoryIndex - categoryPositions[category] = { 'index' : len(gresults), 'count' : 8 } + categoryPositions[category] = {'index': len(gresults), 'count': 8} # return gresults return gresults @@ -215,21 +235,21 @@ def score_results(results): def merge_two_infoboxes(infobox1, infobox2): if 'urls' in infobox2: urls1 = infobox1.get('urls', None) - if urls1 == None: + if urls1 is None: urls1 = [] infobox1.set('urls', urls1) urlSet = set() for url in infobox1.get('urls', []): urlSet.add(url.get('url', None)) - + for url in infobox2.get('urls', []): if url.get('url', None) not in urlSet: urls1.append(url) if 'attributes' in infobox2: attributes1 = infobox1.get('attributes', None) - if attributes1 == None: + if attributes1 is None: attributes1 = [] infobox1.set('attributes', attributes1) @@ -237,14 +257,14 @@ def merge_two_infoboxes(infobox1, infobox2): for attribute in infobox1.get('attributes', []): if attribute.get('label', None) not in attributeSet: attributeSet.add(attribute.get('label', None)) - + for attribute in infobox2.get('attributes', []): attributes1.append(attribute) if 'content' in infobox2: content1 = infobox1.get('content', None) content2 = infobox2.get('content', '') - if content1 != None: + if content1 is not None: if content_result_len(content2) > content_result_len(content1): infobox1['content'] = content2 else: @@ -257,12 +277,12 @@ def merge_infoboxes(infoboxes): for infobox in infoboxes: add_infobox = True infobox_id = infobox.get('id', None) - if infobox_id != None: + if infobox_id is not None: existingIndex = infoboxes_id.get(infobox_id, None) - if existingIndex != None: + if existingIndex is not None: merge_two_infoboxes(results[existingIndex], infobox) - add_infobox=False - + add_infobox = False + if add_infobox: results.append(infobox) infoboxes_id[infobox_id] = len(results)-1 @@ -311,9 +331,6 @@ class Search(object): if not self.request_data.get('q'): raise Exception('noquery') - # set query - self.query = self.request_data['q'] - # set pagenumber pageno_param = self.request_data.get('pageno', '1') if not pageno_param.isdigit() or int(pageno_param) < 1: @@ -321,9 +338,13 @@ class Search(object): self.pageno = int(pageno_param) - # parse query, if tags are set, which change the serch engine or search-language - query_obj = Query(self.query, self.blocked_engines) - query_obj.parse_query() + # parse query, if tags are set, which change + # the serch engine or search-language + query_obj = Query(self.request_data['q'], self.blocked_engines) + query_obj.parse_query() + + # set query + self.query = query_obj.getSearchQuery() # get last selected language in query, if possible # TODO support search with multible languages @@ -334,25 +355,29 @@ class Search(object): self.categories = [] - # if engines are calculated from query, set categories by using that informations + # if engines are calculated from query, + # set categories by using that informations if self.engines: self.categories = list(set(engine['category'] for engine in self.engines)) - # otherwise, using defined categories to calculate which engines should be used + # otherwise, using defined categories to + # calculate which engines should be used else: # set used categories for pd_name, pd in self.request_data.items(): if pd_name.startswith('category_'): category = pd_name[9:] # if category is not found in list, skip - if not category in categories: + if category not in categories: continue # add category to list self.categories.append(category) - # if no category is specified for this search, using user-defined default-configuration which (is stored in cookie) + # if no category is specified for this search, + # using user-defined default-configuration which + # (is stored in cookie) if not self.categories: cookie_categories = request.cookies.get('categories', '') cookie_categories = cookie_categories.split(',') @@ -360,16 +385,18 @@ class Search(object): if ccateg in categories: self.categories.append(ccateg) - # if still no category is specified, using general as default-category + # if still no category is specified, using general + # as default-category if not self.categories: self.categories = ['general'] - # using all engines for that search, which are declared under the specific categories + # using all engines for that search, which are + # declared under the specific categories for categ in self.categories: self.engines.extend({'category': categ, 'name': x.name} for x in categories[categ] - if not x.name in self.blocked_engines) + if x.name not in self.blocked_engines) # do search-request def search(self, request): @@ -386,7 +413,7 @@ class Search(object): number_of_searches += 1 # set default useragent - #user_agent = request.headers.get('User-Agent', '') + # user_agent = request.headers.get('User-Agent', '') user_agent = gen_useragent() # start search-reqest for all selected engines @@ -400,7 +427,8 @@ class Search(object): if self.pageno > 1 and not engine.paging: continue - # if search-language is set and engine does not provide language-support, skip + # if search-language is set and engine does not + # provide language-support, skip if self.lang != 'all' and not engine.language_support: continue @@ -412,7 +440,8 @@ class Search(object): request_params['pageno'] = self.pageno request_params['language'] = self.lang - # update request parameters dependent on search-engine (contained in engines folder) + # update request parameters dependent on + # search-engine (contained in engines folder) request_params = engine.request(self.query.encode('utf-8'), request_params) @@ -431,7 +460,8 @@ class Search(object): request_params ) - # create dictionary which contain all informations about the request + # create dictionary which contain all + # informations about the request request_args = dict( headers=request_params['headers'], hooks=dict(response=callback), diff --git a/searx/settings.yml b/searx/settings.yml index fb71b5ff2..c4589a0a7 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -52,6 +52,12 @@ engines: engine : duckduckgo shortcut : ddg +# api-key required: http://www.faroo.com/hp/api/api.html#key +# - name : faroo +# engine : faroo +# shortcut : fa +# api_key : 'apikey' # required! + # down - website is under criminal investigation by the UK # - name : filecrop # engine : filecrop @@ -166,3 +172,4 @@ locales: es : Español it : Italiano nl : Nederlands + ja : 日本語 (Japanese) diff --git a/searx/settings_robot.yml b/searx/settings_robot.yml index 98944a811..bb91dce8f 100644 --- a/searx/settings_robot.yml +++ b/searx/settings_robot.yml @@ -4,6 +4,9 @@ server: debug : False request_timeout : 3.0 # seconds base_url: False + themes_path : "" + default_theme : default + https_rewrite : True engines: - name : general_dummy diff --git a/searx/static/default/css/style.css b/searx/static/default/css/style.css index 182a08e32..70265b072 100644 --- a/searx/static/default/css/style.css +++ b/searx/static/default/css/style.css @@ -77,5 +77,5 @@ tr:hover{background:#ddd} #preferences{top:10px;padding:0;border:0;background:url('../img/preference-icon.png') no-repeat;background-size:28px 28px;opacity:.8;width:28px;height:30px;display:block}#preferences *{display:none} #pagination{clear:both;width:40em} #apis{margin-top:8px;clear:both} -@media screen and (max-width:50em){#results{margin:auto;padding:0;width:90%} .github{display:none} .checkbox_container{display:block;width:90%}.checkbox_container label{border-bottom:0}}@media screen and (max-width:75em){#infoboxes{position:inherit;max-width:inherit}#infoboxes .infobox{clear:both}#infoboxes .infobox img{float:left;max-width:10em} #categories{font-size:90%;clear:both}#categories .checkbox_container{margin-top:2px;margin:auto} .right{display:none;postion:fixed !important;top:100px;right:0} #sidebar{position:static;max-width:50em;margin:0 0 2px 0;padding:0;float:none;border:none;width:auto}#sidebar input{border:0} #apis{display:none} #search_url{display:none} .result{border-top:1px solid #e8e7e6;margin:7px 0 6px 0}}.favicon{float:left;margin-right:4px;margin-top:2px} +@media screen and (max-width:50em){#results{margin:auto;padding:0;width:90%} .github{display:none} .checkbox_container{display:block;width:90%}.checkbox_container label{border-bottom:0} .right{display:none;postion:fixed !important;top:100px;right:0}}@media screen and (max-width:75em){#infoboxes{position:inherit;max-width:inherit}#infoboxes .infobox{clear:both}#infoboxes .infobox img{float:left;max-width:10em} #categories{font-size:90%;clear:both}#categories .checkbox_container{margin-top:2px;margin:auto} #sidebar{position:static;max-width:50em;margin:0 0 2px 0;padding:0;float:none;border:none;width:auto}#sidebar input{border:0} #apis{display:none} #search_url{display:none} .result{border-top:1px solid #e8e7e6;margin:7px 0 6px 0}}.favicon{float:left;margin-right:4px;margin-top:2px} .preferences_back{background:none repeat scroll 0 0 #3498db;border:0 none;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;cursor:pointer;display:inline-block;margin:2px 4px;padding:4px 6px}.preferences_back a{color:#fff} diff --git a/searx/static/default/less/style.less b/searx/static/default/less/style.less index 091728603..c43c0fe72 100644 --- a/searx/static/default/less/style.less +++ b/searx/static/default/less/style.less @@ -529,6 +529,14 @@ tr { border-bottom: 0; } } + + .right { + display: none; + postion: fixed !important; + top: 100px; + right: 0px; + } + } @media screen and (max-width: 75em) { @@ -558,13 +566,6 @@ tr { } } - .right { - display: none; - postion: fixed !important; - top: 100px; - right: 0px; - } - #sidebar { position: static; max-width: @results-width; diff --git a/searx/translations/de/LC_MESSAGES/messages.mo b/searx/translations/de/LC_MESSAGES/messages.mo index dc2922786..9d5e2cb12 100644 Binary files a/searx/translations/de/LC_MESSAGES/messages.mo and b/searx/translations/de/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/de/LC_MESSAGES/messages.po b/searx/translations/de/LC_MESSAGES/messages.po index c4038ba85..1cda4b827 100644 --- a/searx/translations/de/LC_MESSAGES/messages.po +++ b/searx/translations/de/LC_MESSAGES/messages.po @@ -5,11 +5,12 @@ # Translators: # pointhi, 2014 # stf , 2014 +# rike, 2014 msgid "" msgstr "" "Project-Id-Version: searx\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" "PO-Revision-Date: 2014-03-15 18:40+0000\n" "Last-Translator: pointhi\n" "Language-Team: German " @@ -20,31 +21,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" -msgstr "" +msgstr "vor {minutes} Minute(n)" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" -msgstr "" +msgstr "vor {hours} Stunde(n), {minutes} Minute(n)" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr "Ladezeit (sek)" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "Trefferanzahl" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "Punkte" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "Punkte pro Treffer" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "Fehler" @@ -69,7 +70,7 @@ msgstr "Einstellungen" #: searx/templates/default/preferences.html:9 #: searx/templates/oscar/preferences.html:21 msgid "Default categories" -msgstr "Standard Kategorien" +msgstr "Standardkategorien" #: searx/templates/courgette/preferences.html:15 #: searx/templates/default/preferences.html:15 @@ -93,19 +94,19 @@ msgstr "Oberflächensprache" #: searx/templates/default/preferences.html:36 #: searx/templates/oscar/preferences.html:50 msgid "Autocomplete" -msgstr "" +msgstr "Autovervollständigung" #: searx/templates/courgette/preferences.html:47 #: searx/templates/default/preferences.html:47 #: searx/templates/oscar/preferences.html:63 msgid "Method" -msgstr "" +msgstr "Methode" #: searx/templates/courgette/preferences.html:56 #: searx/templates/default/preferences.html:56 #: searx/templates/oscar/preferences.html:73 msgid "Themes" -msgstr "" +msgstr "Designs" #: searx/templates/courgette/preferences.html:66 #: searx/templates/default/preferences.html:66 @@ -145,8 +146,8 @@ msgid "" "These settings are stored in your cookies, this allows us not to store " "this data about you." msgstr "" -"Diese Informationen werden in Cookies gespeichert, damit wir keine ihrer " -"persönlichen Daten speichern müssen." +"Diese Informationen werden in Cookies auf Ihrem Rechner gespeichert, " +"damit wir keine Ihrer persönlichen Daten speichern müssen." #: searx/templates/courgette/preferences.html:94 #: searx/templates/default/preferences.html:94 @@ -155,8 +156,8 @@ msgid "" "These cookies serve your sole convenience, we don't use these cookies to " "track you." msgstr "" -"Diese Cookies dienen ihrer Gemütlichkeit, wir verwenden sie nicht zum " -"überwachen." +"Diese Cookies dienen einzig Ihrem Komfort, wir verwenden sie nicht, um " +"Sie zu überwachen." #: searx/templates/courgette/preferences.html:97 #: searx/templates/default/preferences.html:97 @@ -172,30 +173,30 @@ msgstr "Zurück" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "Such-URL" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "Ergebnisse herunterladen" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "Vorschläge" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "vorherige Seite" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "nächste Seite" @@ -209,7 +210,11 @@ msgstr "Suche nach..." #: searx/templates/courgette/stats.html:4 searx/templates/default/stats.html:4 #: searx/templates/oscar/stats.html:5 msgid "Engine stats" -msgstr "Suchmaschienen Statistiken" +msgstr "Suchmaschinenstatistik" + +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" #: searx/templates/oscar/base.html:61 msgid "Powered by" @@ -228,14 +233,12 @@ msgid "home" msgstr "" #: searx/templates/oscar/preferences.html:11 -#, fuzzy msgid "General" msgstr "Allgemein" #: searx/templates/oscar/preferences.html:12 -#, fuzzy msgid "Engines" -msgstr "Suchmaschienen Statistiken" +msgstr "" #: searx/templates/oscar/preferences.html:36 msgid "What language do you prefer for search?" @@ -261,11 +264,10 @@ msgid "Change searx layout" msgstr "" #: searx/templates/oscar/results.html:6 -#, fuzzy msgid "Search results" -msgstr "Trefferanzahl" +msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -340,9 +342,8 @@ msgid "Something went wrong." msgstr "" #: searx/templates/oscar/result_templates/images.html:20 -#, fuzzy msgid "Get image" -msgstr "nächste Seite" +msgstr "" #: searx/templates/oscar/result_templates/images.html:21 msgid "View source" @@ -379,3 +380,6 @@ msgstr "IT" msgid "news" msgstr "Neuigkeiten" +msgid "map" +msgstr "Karte" + diff --git a/searx/translations/en/LC_MESSAGES/messages.mo b/searx/translations/en/LC_MESSAGES/messages.mo index 4f81aa4ba..381a661cc 100644 Binary files a/searx/translations/en/LC_MESSAGES/messages.mo and b/searx/translations/en/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/en/LC_MESSAGES/messages.po b/searx/translations/en/LC_MESSAGES/messages.po index 202862d2b..a8d3212c8 100644 --- a/searx/translations/en/LC_MESSAGES/messages.po +++ b/searx/translations/en/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" "PO-Revision-Date: 2014-01-30 15:22+0100\n" "Last-Translator: FULL NAME \n" "Language-Team: en \n" @@ -17,31 +17,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" msgstr "" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" msgstr "" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr "" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "" @@ -165,30 +165,30 @@ msgstr "" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "" @@ -204,6 +204,10 @@ msgstr "" msgid "Engine stats" msgstr "" +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + #: searx/templates/oscar/base.html:61 msgid "Powered by" msgstr "" @@ -255,7 +259,7 @@ msgstr "" msgid "Search results" msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -350,9 +354,6 @@ msgstr "" msgid "files" msgstr "" -msgid "general" -msgstr "" - msgid "music" msgstr "" @@ -371,3 +372,6 @@ msgstr "" msgid "news" msgstr "" +msgid "map" +msgstr "" + diff --git a/searx/translations/es/LC_MESSAGES/messages.mo b/searx/translations/es/LC_MESSAGES/messages.mo index 69c0fdfd8..498b480a1 100644 Binary files a/searx/translations/es/LC_MESSAGES/messages.mo and b/searx/translations/es/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/es/LC_MESSAGES/messages.po b/searx/translations/es/LC_MESSAGES/messages.po index cd0c75f0d..db663bf54 100644 --- a/searx/translations/es/LC_MESSAGES/messages.po +++ b/searx/translations/es/LC_MESSAGES/messages.po @@ -3,14 +3,14 @@ # This file is distributed under the same license as the project. # # Translators: -# niazle, 2014 +# Alejandro León Aznar, 2014 msgid "" msgstr "" "Project-Id-Version: searx\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" -"PO-Revision-Date: 2014-03-04 20:40+0000\n" -"Last-Translator: niazle\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" +"PO-Revision-Date: 2014-09-08 11:01+0000\n" +"Last-Translator: Alejandro León Aznar\n" "Language-Team: Spanish " "(http://www.transifex.com/projects/p/searx/language/es/)\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -19,31 +19,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" -msgstr "" +msgstr "hace {minutes} minuto(s)" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" -msgstr "" +msgstr "hace {hours} hora(s) y {minutes} minuto(s)" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr "Tiempo de carga (segundos)" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "Número de resultados" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "Puntuaciones" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "Puntuaciones por resultado" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "Errores" @@ -171,30 +171,30 @@ msgstr "Atrás" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "Buscar URL" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "Descargar resultados" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "Sugerencias" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "Página anterior" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "Página siguiente" @@ -203,13 +203,17 @@ msgstr "Página siguiente" #: searx/templates/default/search.html:3 searx/templates/oscar/search.html:4 #: searx/templates/oscar/search_full.html:5 msgid "Search for..." -msgstr "" +msgstr "Buscar..." #: searx/templates/courgette/stats.html:4 searx/templates/default/stats.html:4 #: searx/templates/oscar/stats.html:5 msgid "Engine stats" msgstr "Estadísticas del motor de búsqueda" +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + #: searx/templates/oscar/base.html:61 msgid "Powered by" msgstr "" @@ -227,14 +231,12 @@ msgid "home" msgstr "" #: searx/templates/oscar/preferences.html:11 -#, fuzzy msgid "General" -msgstr "General" +msgstr "" #: searx/templates/oscar/preferences.html:12 -#, fuzzy msgid "Engines" -msgstr "Estadísticas del motor de búsqueda" +msgstr "" #: searx/templates/oscar/preferences.html:36 msgid "What language do you prefer for search?" @@ -260,11 +262,10 @@ msgid "Change searx layout" msgstr "" #: searx/templates/oscar/results.html:6 -#, fuzzy msgid "Search results" -msgstr "Número de resultados" +msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -339,9 +340,8 @@ msgid "Something went wrong." msgstr "" #: searx/templates/oscar/result_templates/images.html:20 -#, fuzzy msgid "Get image" -msgstr "Página siguiente" +msgstr "" #: searx/templates/oscar/result_templates/images.html:21 msgid "View source" @@ -378,3 +378,6 @@ msgstr "TIC" msgid "news" msgstr "noticias" +msgid "map" +msgstr "mapa" + diff --git a/searx/translations/fr/LC_MESSAGES/messages.mo b/searx/translations/fr/LC_MESSAGES/messages.mo index 09022d0c9..fcefbe1db 100644 Binary files a/searx/translations/fr/LC_MESSAGES/messages.mo and b/searx/translations/fr/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/fr/LC_MESSAGES/messages.po b/searx/translations/fr/LC_MESSAGES/messages.po index 8e29d5f65..0a0ec424c 100644 --- a/searx/translations/fr/LC_MESSAGES/messages.po +++ b/searx/translations/fr/LC_MESSAGES/messages.po @@ -5,14 +5,14 @@ # Translators: # Benjamin Sonntag , 2014 # FIRST AUTHOR , 2014 -# rike , 2014 +# rike, 2014 msgid "" msgstr "" "Project-Id-Version: searx\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" -"PO-Revision-Date: 2014-03-16 07:40+0000\n" -"Last-Translator: Benjamin Sonntag \n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" +"PO-Revision-Date: 2014-09-07 21:24+0000\n" +"Last-Translator: Adam Tauber \n" "Language-Team: French " "(http://www.transifex.com/projects/p/searx/language/fr/)\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" @@ -21,31 +21,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" -msgstr "Il y a {minutes} minute(s)" +msgstr "il y a {minutes} minute(s)" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" -msgstr "Il y a {hours} heure(s), {minutes} minute(s)" +msgstr "il y a {hours} heure(s), {minutes} minute(s)" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr "Chargement de la page (sec)" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "Nombre de résultats" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "Score" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "Score par résultat" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "Erreurs" @@ -111,7 +111,7 @@ msgstr "" #: searx/templates/courgette/preferences.html:66 #: searx/templates/default/preferences.html:66 msgid "Currently used search engines" -msgstr "Moteurs actuellement utilisés" +msgstr "Moteurs de recherche actuellement utilisés" #: searx/templates/courgette/preferences.html:70 #: searx/templates/default/preferences.html:70 @@ -173,30 +173,30 @@ msgstr "retour" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "URL de recherche" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "Télécharger les résultats" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "Suggestions" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "page précédente" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "page suivante" @@ -212,6 +212,10 @@ msgstr "Rechercher..." msgid "Engine stats" msgstr "Statistiques du moteur" +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + #: searx/templates/oscar/base.html:61 msgid "Powered by" msgstr "" @@ -229,14 +233,12 @@ msgid "home" msgstr "" #: searx/templates/oscar/preferences.html:11 -#, fuzzy msgid "General" -msgstr "général" +msgstr "" #: searx/templates/oscar/preferences.html:12 -#, fuzzy msgid "Engines" -msgstr "Statistiques du moteur" +msgstr "" #: searx/templates/oscar/preferences.html:36 msgid "What language do you prefer for search?" @@ -262,11 +264,10 @@ msgid "Change searx layout" msgstr "" #: searx/templates/oscar/results.html:6 -#, fuzzy msgid "Search results" -msgstr "Nombre de résultats" +msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -341,9 +342,8 @@ msgid "Something went wrong." msgstr "" #: searx/templates/oscar/result_templates/images.html:20 -#, fuzzy msgid "Get image" -msgstr "page suivante" +msgstr "" #: searx/templates/oscar/result_templates/images.html:21 msgid "View source" @@ -380,3 +380,6 @@ msgstr "Informatique" msgid "news" msgstr "actus" +msgid "map" +msgstr "" + diff --git a/searx/translations/hu/LC_MESSAGES/messages.mo b/searx/translations/hu/LC_MESSAGES/messages.mo index 64beee1af..2724ab12f 100644 Binary files a/searx/translations/hu/LC_MESSAGES/messages.mo and b/searx/translations/hu/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/hu/LC_MESSAGES/messages.po b/searx/translations/hu/LC_MESSAGES/messages.po index 726b39c67..625e17e9b 100644 --- a/searx/translations/hu/LC_MESSAGES/messages.po +++ b/searx/translations/hu/LC_MESSAGES/messages.po @@ -1,47 +1,50 @@ -# Hungarian translations for PROJECT. +# English translations for . # Copyright (C) 2014 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2014. +# This file is distributed under the same license as the project. # +# Translators: +# Adam Tauber , 2014 +# FIRST AUTHOR , 2014 msgid "" msgstr "" -"Project-Id-Version: PROJECT VERSION\n" +"Project-Id-Version: searx\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" -"PO-Revision-Date: 2014-01-21 23:33+0100\n" -"Last-Translator: FULL NAME \n" -"Language-Team: hu \n" -"Plural-Forms: nplurals=1; plural=0\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" +"PO-Revision-Date: 2014-09-07 21:30+0000\n" +"Last-Translator: Adam Tauber \n" +"Language-Team: Hungarian " +"(http://www.transifex.com/projects/p/searx/language/hu/)\n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" msgstr "{minutes} perce" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" msgstr "{hours} óra, {minutes} perce" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr "Válaszidők (sec)" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "Találatok száma" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "Pontszámok" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "Pontszámok találatonként" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "Hibák" @@ -167,30 +170,30 @@ msgstr "vissza" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "Keresési URL" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "Találatok letöltése" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "Javaslatok" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "előző oldal" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "következő oldal" @@ -206,6 +209,10 @@ msgstr "Keresés..." msgid "Engine stats" msgstr "Kereső statisztikák" +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + #: searx/templates/oscar/base.html:61 msgid "Powered by" msgstr "" @@ -223,14 +230,12 @@ msgid "home" msgstr "" #: searx/templates/oscar/preferences.html:11 -#, fuzzy msgid "General" -msgstr "általános" +msgstr "" #: searx/templates/oscar/preferences.html:12 -#, fuzzy msgid "Engines" -msgstr "Kereső statisztikák" +msgstr "" #: searx/templates/oscar/preferences.html:36 msgid "What language do you prefer for search?" @@ -256,11 +261,10 @@ msgid "Change searx layout" msgstr "" #: searx/templates/oscar/results.html:6 -#, fuzzy msgid "Search results" -msgstr "Találatok száma" +msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -335,9 +339,8 @@ msgid "Something went wrong." msgstr "" #: searx/templates/oscar/result_templates/images.html:20 -#, fuzzy msgid "Get image" -msgstr "következő oldal" +msgstr "" #: searx/templates/oscar/result_templates/images.html:21 msgid "View source" @@ -374,3 +377,6 @@ msgstr "it" msgid "news" msgstr "hírek" +msgid "map" +msgstr "térkép" + diff --git a/searx/translations/it/LC_MESSAGES/messages.mo b/searx/translations/it/LC_MESSAGES/messages.mo index ffd0dc9e5..b27fb8e46 100644 Binary files a/searx/translations/it/LC_MESSAGES/messages.mo and b/searx/translations/it/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/it/LC_MESSAGES/messages.po b/searx/translations/it/LC_MESSAGES/messages.po index a2e086425..4e20ccb28 100644 --- a/searx/translations/it/LC_MESSAGES/messages.po +++ b/searx/translations/it/LC_MESSAGES/messages.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: searx\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" -"PO-Revision-Date: 2014-03-05 13:30+0000\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" +"PO-Revision-Date: 2014-09-08 08:19+0000\n" "Last-Translator: dp \n" "Language-Team: Italian " "(http://www.transifex.com/projects/p/searx/language/it/)\n" @@ -19,31 +19,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" -msgstr "" +msgstr "di {minutes} minuti fa" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" -msgstr "" +msgstr "di {ore} h e {minutes} minuti fa" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr " Caricamento della pagina (secondi)" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "Risultati ottenuti" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "Punteggio" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "Punteggio per risultato" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "Errori" @@ -171,30 +171,30 @@ msgstr "indietro" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "URL della ricerca" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "Scarica i risultati" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "Suggerimenti" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "pagina precedente" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "pagina successiva" @@ -203,13 +203,17 @@ msgstr "pagina successiva" #: searx/templates/default/search.html:3 searx/templates/oscar/search.html:4 #: searx/templates/oscar/search_full.html:5 msgid "Search for..." -msgstr "" +msgstr "Cerca…" #: searx/templates/courgette/stats.html:4 searx/templates/default/stats.html:4 #: searx/templates/oscar/stats.html:5 msgid "Engine stats" msgstr "Statistiche dei motori" +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + #: searx/templates/oscar/base.html:61 msgid "Powered by" msgstr "" @@ -227,14 +231,12 @@ msgid "home" msgstr "" #: searx/templates/oscar/preferences.html:11 -#, fuzzy msgid "General" -msgstr "generale" +msgstr "" #: searx/templates/oscar/preferences.html:12 -#, fuzzy msgid "Engines" -msgstr "Statistiche dei motori" +msgstr "" #: searx/templates/oscar/preferences.html:36 msgid "What language do you prefer for search?" @@ -260,11 +262,10 @@ msgid "Change searx layout" msgstr "" #: searx/templates/oscar/results.html:6 -#, fuzzy msgid "Search results" -msgstr "Risultati ottenuti" +msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -339,9 +340,8 @@ msgid "Something went wrong." msgstr "" #: searx/templates/oscar/result_templates/images.html:20 -#, fuzzy msgid "Get image" -msgstr "pagina successiva" +msgstr "" #: searx/templates/oscar/result_templates/images.html:21 msgid "View source" @@ -378,3 +378,6 @@ msgstr "it" msgid "news" msgstr "notizie" +msgid "map" +msgstr "mappe" + diff --git a/searx/translations/ja/LC_MESSAGES/messages.mo b/searx/translations/ja/LC_MESSAGES/messages.mo new file mode 100644 index 000000000..f1621bfe3 Binary files /dev/null and b/searx/translations/ja/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/ja/LC_MESSAGES/messages.po b/searx/translations/ja/LC_MESSAGES/messages.po new file mode 100644 index 000000000..cb15bbb10 --- /dev/null +++ b/searx/translations/ja/LC_MESSAGES/messages.po @@ -0,0 +1,377 @@ +# Japanese translations for PROJECT. +# Copyright (C) 2014 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" +"PO-Revision-Date: 2014-10-05 16:38+0200\n" +"Last-Translator: FULL NAME \n" +"Language-Team: ja \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 1.3\n" + +#: searx/webapp.py:305 +msgid "{minutes} minute(s) ago" +msgstr "" + +#: searx/webapp.py:307 +msgid "{hours} hour(s), {minutes} minute(s) ago" +msgstr "" + +#: searx/engines/__init__.py:177 +msgid "Page loads (sec)" +msgstr "" + +#: searx/engines/__init__.py:181 +msgid "Number of results" +msgstr "" + +#: searx/engines/__init__.py:185 +msgid "Scores" +msgstr "" + +#: searx/engines/__init__.py:189 +msgid "Scores per result" +msgstr "" + +#: searx/engines/__init__.py:193 +msgid "Errors" +msgstr "" + +#: searx/templates/courgette/index.html:8 searx/templates/default/index.html:8 +#: searx/templates/oscar/about.html:3 searx/templates/oscar/navbar.html:16 +msgid "about" +msgstr "に関する" + +#: searx/templates/courgette/index.html:9 searx/templates/default/index.html:9 +#: searx/templates/oscar/navbar.html:17 +#: searx/templates/oscar/preferences.html:2 +msgid "preferences" +msgstr "設定" + +#: searx/templates/courgette/preferences.html:5 +#: searx/templates/default/preferences.html:5 +#: searx/templates/oscar/preferences.html:6 +msgid "Preferences" +msgstr "設定" + +#: searx/templates/courgette/preferences.html:9 +#: searx/templates/default/preferences.html:9 +#: searx/templates/oscar/preferences.html:21 +msgid "Default categories" +msgstr "" + +#: searx/templates/courgette/preferences.html:15 +#: searx/templates/default/preferences.html:15 +#: searx/templates/oscar/preferences.html:27 +msgid "Search language" +msgstr "" + +#: searx/templates/courgette/preferences.html:18 +#: searx/templates/default/preferences.html:18 +#: searx/templates/oscar/preferences.html:30 +msgid "Automatic" +msgstr "" + +#: searx/templates/courgette/preferences.html:26 +#: searx/templates/default/preferences.html:26 +#: searx/templates/oscar/preferences.html:39 +msgid "Interface language" +msgstr "" + +#: searx/templates/courgette/preferences.html:36 +#: searx/templates/default/preferences.html:36 +#: searx/templates/oscar/preferences.html:50 +msgid "Autocomplete" +msgstr "" + +#: searx/templates/courgette/preferences.html:47 +#: searx/templates/default/preferences.html:47 +#: searx/templates/oscar/preferences.html:63 +msgid "Method" +msgstr "" + +#: searx/templates/courgette/preferences.html:56 +#: searx/templates/default/preferences.html:56 +#: searx/templates/oscar/preferences.html:73 +msgid "Themes" +msgstr "" + +#: searx/templates/courgette/preferences.html:66 +#: searx/templates/default/preferences.html:66 +msgid "Currently used search engines" +msgstr "" + +#: searx/templates/courgette/preferences.html:70 +#: searx/templates/default/preferences.html:70 +msgid "Engine name" +msgstr "" + +#: searx/templates/courgette/preferences.html:71 +#: searx/templates/default/preferences.html:71 +msgid "Category" +msgstr "" + +#: searx/templates/courgette/preferences.html:72 +#: searx/templates/courgette/preferences.html:83 +#: searx/templates/default/preferences.html:72 +#: searx/templates/default/preferences.html:83 +#: searx/templates/oscar/preferences.html:110 +msgid "Allow" +msgstr "" + +#: searx/templates/courgette/preferences.html:72 +#: searx/templates/courgette/preferences.html:84 +#: searx/templates/default/preferences.html:72 +#: searx/templates/default/preferences.html:84 +#: searx/templates/oscar/preferences.html:109 +msgid "Block" +msgstr "" + +#: searx/templates/courgette/preferences.html:92 +#: searx/templates/default/preferences.html:92 +#: searx/templates/oscar/preferences.html:124 +msgid "" +"These settings are stored in your cookies, this allows us not to store " +"this data about you." +msgstr "" + +#: searx/templates/courgette/preferences.html:94 +#: searx/templates/default/preferences.html:94 +#: searx/templates/oscar/preferences.html:126 +msgid "" +"These cookies serve your sole convenience, we don't use these cookies to " +"track you." +msgstr "" + +#: searx/templates/courgette/preferences.html:97 +#: searx/templates/default/preferences.html:97 +#: searx/templates/oscar/preferences.html:129 +msgid "save" +msgstr "" + +#: searx/templates/courgette/preferences.html:98 +#: searx/templates/default/preferences.html:98 +#: searx/templates/oscar/preferences.html:130 +msgid "back" +msgstr "" + +#: searx/templates/courgette/results.html:12 +#: searx/templates/default/results.html:12 +#: searx/templates/oscar/results.html:70 +msgid "Search URL" +msgstr "" + +#: searx/templates/courgette/results.html:16 +#: searx/templates/default/results.html:16 +#: searx/templates/oscar/results.html:75 +msgid "Download results" +msgstr "" + +#: searx/templates/courgette/results.html:34 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 +msgid "Suggestions" +msgstr "提案" + +#: searx/templates/courgette/results.html:62 +#: searx/templates/default/results.html:78 +#: searx/templates/oscar/results.html:29 +msgid "previous page" +msgstr "前のページ" + +#: searx/templates/courgette/results.html:73 +#: searx/templates/default/results.html:89 +#: searx/templates/oscar/results.html:37 +msgid "next page" +msgstr "次のページ" + +#: searx/templates/courgette/search.html:3 +#: searx/templates/default/search.html:3 searx/templates/oscar/search.html:4 +#: searx/templates/oscar/search_full.html:5 +msgid "Search for..." +msgstr "検索する..." + +#: searx/templates/courgette/stats.html:4 searx/templates/default/stats.html:4 +#: searx/templates/oscar/stats.html:5 +msgid "Engine stats" +msgstr "" + +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + +#: searx/templates/oscar/base.html:61 +msgid "Powered by" +msgstr "" + +#: searx/templates/oscar/base.html:61 +msgid "a privacy-respecting, hackable metasearch engine" +msgstr "" + +#: searx/templates/oscar/navbar.html:6 +msgid "Toggle navigation" +msgstr "" + +#: searx/templates/oscar/navbar.html:15 +msgid "home" +msgstr "" + +#: searx/templates/oscar/preferences.html:11 +msgid "General" +msgstr "" + +#: searx/templates/oscar/preferences.html:12 +msgid "Engines" +msgstr "" + +#: searx/templates/oscar/preferences.html:36 +msgid "What language do you prefer for search?" +msgstr "" + +#: searx/templates/oscar/preferences.html:47 +msgid "Change the language of the layout" +msgstr "" + +#: searx/templates/oscar/preferences.html:60 +msgid "Find stuff as you type" +msgstr "" + +#: searx/templates/oscar/preferences.html:70 +msgid "" +"Change how forms are submited, learn more about request methods" +msgstr "" + +#: searx/templates/oscar/preferences.html:81 +msgid "Change searx layout" +msgstr "" + +#: searx/templates/oscar/results.html:6 +msgid "Search results" +msgstr "" + +#: searx/templates/oscar/results.html:65 +msgid "Links" +msgstr "" + +#: searx/templates/oscar/search.html:6 searx/templates/oscar/search_full.html:7 +msgid "Start search" +msgstr "" + +#: searx/templates/oscar/search_full.html:11 +msgid "Show search filters" +msgstr "" + +#: searx/templates/oscar/search_full.html:11 +msgid "Hide search filters" +msgstr "" + +#: searx/templates/oscar/stats.html:2 +msgid "stats" +msgstr "" + +#: searx/templates/oscar/messages/first_time.html:4 +#: searx/templates/oscar/messages/no_results.html:5 +#: searx/templates/oscar/messages/save_settings_successfull.html:5 +#: searx/templates/oscar/messages/unknow_error.html:5 +msgid "Close" +msgstr "" + +#: searx/templates/oscar/messages/first_time.html:6 +#: searx/templates/oscar/messages/no_data_available.html:3 +msgid "Heads up!" +msgstr "" + +#: searx/templates/oscar/messages/first_time.html:7 +msgid "It look like you are using searx first time." +msgstr "" + +#: searx/templates/oscar/messages/js_disabled.html:2 +msgid "Warning!" +msgstr "" + +#: searx/templates/oscar/messages/js_disabled.html:3 +msgid "Please enable JavaScript to use full functionality of this site." +msgstr "" + +#: searx/templates/oscar/messages/no_data_available.html:4 +msgid "There is currently no data available. " +msgstr "" + +#: searx/templates/oscar/messages/no_results.html:7 +msgid "Sorry!" +msgstr "" + +#: searx/templates/oscar/messages/no_results.html:8 +msgid "" +"we didn't find any results. Please use another query or search in more " +"categories." +msgstr "" + +#: searx/templates/oscar/messages/save_settings_successfull.html:7 +msgid "Well done!" +msgstr "" + +#: searx/templates/oscar/messages/save_settings_successfull.html:8 +msgid "Settings saved successfully." +msgstr "" + +#: searx/templates/oscar/messages/unknow_error.html:7 +msgid "Oh snap!" +msgstr "" + +#: searx/templates/oscar/messages/unknow_error.html:8 +msgid "Something went wrong." +msgstr "" + +#: searx/templates/oscar/result_templates/images.html:20 +msgid "Get image" +msgstr "" + +#: searx/templates/oscar/result_templates/images.html:21 +msgid "View source" +msgstr "" + +#: searx/templates/oscar/result_templates/torrent.html:7 +msgid "Seeder" +msgstr "" + +#: searx/templates/oscar/result_templates/torrent.html:7 +msgid "Leecher" +msgstr "" + +# categories - manually added +# TODO - automatically add +msgid "files" +msgstr "ファイル" + +msgid "map" +msgstr "地図" + +msgid "music" +msgstr "音楽" + +msgid "social media" +msgstr "ソーシャルメディア" + +msgid "images" +msgstr "画像" + +msgid "videos" +msgstr "動画" + +msgid "it" +msgstr "情報技術" + +msgid "news" +msgstr "ニュース" + diff --git a/searx/translations/nl/LC_MESSAGES/messages.mo b/searx/translations/nl/LC_MESSAGES/messages.mo index 6f456e165..51e94d2be 100644 Binary files a/searx/translations/nl/LC_MESSAGES/messages.mo and b/searx/translations/nl/LC_MESSAGES/messages.mo differ diff --git a/searx/translations/nl/LC_MESSAGES/messages.po b/searx/translations/nl/LC_MESSAGES/messages.po index 7819ddc81..3796caaf1 100644 --- a/searx/translations/nl/LC_MESSAGES/messages.po +++ b/searx/translations/nl/LC_MESSAGES/messages.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: searx\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2014-10-01 19:45+0200\n" -"PO-Revision-Date: 2014-03-15 20:20+0000\n" +"POT-Creation-Date: 2014-10-26 19:10+0100\n" +"PO-Revision-Date: 2014-09-09 15:33+0000\n" "Last-Translator: André Koot \n" "Language-Team: Dutch " "(http://www.transifex.com/projects/p/searx/language/nl/)\n" @@ -19,31 +19,31 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 1.3\n" -#: searx/webapp.py:252 +#: searx/webapp.py:305 msgid "{minutes} minute(s) ago" -msgstr "" +msgstr "{minutes} min geleden" -#: searx/webapp.py:254 +#: searx/webapp.py:307 msgid "{hours} hour(s), {minutes} minute(s) ago" -msgstr "" +msgstr "{hours} uur, {minutes} min geleden" -#: searx/engines/__init__.py:164 +#: searx/engines/__init__.py:177 msgid "Page loads (sec)" msgstr "Pagina laadt (sec)" -#: searx/engines/__init__.py:168 +#: searx/engines/__init__.py:181 msgid "Number of results" msgstr "Aantal zoekresultaten" -#: searx/engines/__init__.py:172 +#: searx/engines/__init__.py:185 msgid "Scores" msgstr "Scores" -#: searx/engines/__init__.py:176 +#: searx/engines/__init__.py:189 msgid "Scores per result" msgstr "Scores per zoekresultaat" -#: searx/engines/__init__.py:180 +#: searx/engines/__init__.py:193 msgid "Errors" msgstr "Fouten" @@ -171,30 +171,30 @@ msgstr "terug" #: searx/templates/courgette/results.html:12 #: searx/templates/default/results.html:12 -#: searx/templates/oscar/results.html:74 +#: searx/templates/oscar/results.html:70 msgid "Search URL" msgstr "Zoek URL" #: searx/templates/courgette/results.html:16 #: searx/templates/default/results.html:16 -#: searx/templates/oscar/results.html:79 +#: searx/templates/oscar/results.html:75 msgid "Download results" msgstr "Downloaden zoekresultaten" #: searx/templates/courgette/results.html:34 -#: searx/templates/default/results.html:34 -#: searx/templates/oscar/results.html:51 +#: searx/templates/default/results.html:42 +#: searx/templates/oscar/results.html:50 msgid "Suggestions" msgstr "Suggesties" #: searx/templates/courgette/results.html:62 -#: searx/templates/default/results.html:62 +#: searx/templates/default/results.html:78 #: searx/templates/oscar/results.html:29 msgid "previous page" msgstr "vorige pagina" #: searx/templates/courgette/results.html:73 -#: searx/templates/default/results.html:73 +#: searx/templates/default/results.html:89 #: searx/templates/oscar/results.html:37 msgid "next page" msgstr "volgende pagina" @@ -210,6 +210,10 @@ msgstr "Zoeken naar..." msgid "Engine stats" msgstr "Zoekmachinestatistieken" +#: searx/templates/default/results.html:34 +msgid "Answers" +msgstr "" + #: searx/templates/oscar/base.html:61 msgid "Powered by" msgstr "" @@ -227,14 +231,12 @@ msgid "home" msgstr "" #: searx/templates/oscar/preferences.html:11 -#, fuzzy msgid "General" -msgstr "algemeen" +msgstr "" #: searx/templates/oscar/preferences.html:12 -#, fuzzy msgid "Engines" -msgstr "Zoekmachinestatistieken" +msgstr "" #: searx/templates/oscar/preferences.html:36 msgid "What language do you prefer for search?" @@ -260,11 +262,10 @@ msgid "Change searx layout" msgstr "" #: searx/templates/oscar/results.html:6 -#, fuzzy msgid "Search results" -msgstr "Aantal zoekresultaten" +msgstr "" -#: searx/templates/oscar/results.html:68 +#: searx/templates/oscar/results.html:65 msgid "Links" msgstr "" @@ -339,9 +340,8 @@ msgid "Something went wrong." msgstr "" #: searx/templates/oscar/result_templates/images.html:20 -#, fuzzy msgid "Get image" -msgstr "volgende pagina" +msgstr "" #: searx/templates/oscar/result_templates/images.html:21 msgid "View source" @@ -378,3 +378,6 @@ msgstr "it" msgid "news" msgstr "nieuws" +msgid "map" +msgstr "kaart" + diff --git a/searx/utils.py b/searx/utils.py index a9ece355a..7764291fc 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -1,4 +1,4 @@ -#import htmlentitydefs +# import htmlentitydefs from codecs import getincrementalencoder from HTMLParser import HTMLParser from random import choice @@ -20,6 +20,10 @@ def gen_useragent(): return ua.format(os=choice(ua_os), version=choice(ua_versions)) +def searx_useragent(): + return 'searx' + + def highlight_content(content, query): if not content: @@ -64,8 +68,8 @@ class HTMLTextExtractor(HTMLParser): self.result.append(unichr(codepoint)) def handle_entityref(self, name): - #codepoint = htmlentitydefs.name2codepoint[name] - #self.result.append(unichr(codepoint)) + # codepoint = htmlentitydefs.name2codepoint[name] + # self.result.append(unichr(codepoint)) self.result.append(name) def get_text(self): diff --git a/searx/webapp.py b/searx/webapp.py index c6cd78dc5..e25a4067a 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -50,13 +50,16 @@ from searx.search import Search from searx.query import Query from searx.autocomplete import backends as autocomplete_backends +from urlparse import urlparse +import re + static_path, templates_path, themes =\ get_themes(settings['themes_path'] if settings.get('themes_path') else searx_dir) -default_theme = settings['default_theme'] if \ - settings.get('default_theme', None) else 'default' + +default_theme = settings['server'].get('default_theme', 'default') app = Flask( __name__, @@ -143,14 +146,14 @@ def render(template_name, override_theme=None, **kwargs): nonblocked_categories = set(chain.from_iterable(nonblocked_categories)) - if not 'categories' in kwargs: + if 'categories' not in kwargs: kwargs['categories'] = ['general'] kwargs['categories'].extend(x for x in sorted(categories.keys()) if x != 'general' and x in nonblocked_categories) - if not 'selected_categories' in kwargs: + if 'selected_categories' not in kwargs: kwargs['selected_categories'] = [] for arg in request.args: if arg.startswith('category_'): @@ -165,7 +168,7 @@ def render(template_name, override_theme=None, **kwargs): if not kwargs['selected_categories']: kwargs['selected_categories'] = ['general'] - if not 'autocomplete' in kwargs: + if 'autocomplete' not in kwargs: kwargs['autocomplete'] = autocomplete kwargs['method'] = request.cookies.get('method', 'POST') @@ -201,23 +204,72 @@ def index(): 'index.html', ) - search.results, search.suggestions, search.answers, search.infoboxes = search.search(request) + search.results, search.suggestions,\ + search.answers, search.infoboxes = search.search(request) for result in search.results: if not search.paging and engines[result['engine']].paging: search.paging = True + # check if HTTPS rewrite is required if settings['server']['https_rewrite']\ and result['parsed_url'].scheme == 'http': - for http_regex, https_url in https_rules: - if http_regex.match(result['url']): - result['url'] = http_regex.sub(https_url, result['url']) - # TODO result['parsed_url'].scheme + skip_https_rewrite = False + + # check if HTTPS rewrite is possible + for target, rules, exclusions in https_rules: + + # check if target regex match with url + if target.match(result['url']): + # process exclusions + for exclusion in exclusions: + # check if exclusion match with url + if exclusion.match(result['url']): + skip_https_rewrite = True + break + + # skip https rewrite if required + if skip_https_rewrite: + break + + # process rules + for rule in rules: + try: + # TODO, precompile rule + p = re.compile(rule[0]) + + # rewrite url if possible + new_result_url = p.sub(rule[1], result['url']) + except: + break + + # parse new url + new_parsed_url = urlparse(new_result_url) + + # continiue if nothing was rewritten + if result['url'] == new_result_url: + continue + + # get domainname from result + # TODO, does only work correct with TLD's like + # asdf.com, not for asdf.com.de + # TODO, using publicsuffix instead of this rewrite rule + old_result_domainname = '.'.join( + result['parsed_url'].hostname.split('.')[-2:]) + new_result_domainname = '.'.join( + new_parsed_url.hostname.split('.')[-2:]) + + # check if rewritten hostname is the same, + # to protect against wrong or malicious rewrite rules + if old_result_domainname == new_result_domainname: + # set new url + result['url'] = new_result_url + + # target has matched, do not search over the other rules break - # HTTPS rewrite if search.request_data.get('format', 'html') == 'html': if 'content' in result: result['content'] = highlight_content(result['content'], @@ -384,7 +436,7 @@ def preferences(): for pd_name, pd in request.form.items(): if pd_name.startswith('category_'): category = pd_name[9:] - if not category in categories: + if category not in categories: continue selected_categories.append(category) elif pd_name == 'locale' and pd in settings['locales']: diff --git a/setup.py b/setup.py index 7048fa22b..0053ca8b8 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ long_description = read('README.rst') setup( name='searx', - version="0.3.1", + version="0.4.0", description="A privacy-respecting, hackable metasearch engine", long_description=long_description, classifiers=[ @@ -70,6 +70,7 @@ setup( 'translations/*/*/*', 'templates/*/*.xml', 'templates/*/*.html', + 'https_rules/*.xml', 'templates/*/result_templates/*.html', ], },