Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3afdd1d9 authored by asciimoo's avatar asciimoo
Browse files

[enh] settings unification - new dependency: pyyaml

parent 39ebe1d5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
env
engines.cfg
.installed.cfg
.coverage
covearge/
setup.cfg

*.pyc
+1 −2
Original line number Diff line number Diff line
@@ -25,8 +25,7 @@ List of [running instances](https://github.com/asciimoo/searx/wiki/Searx-instanc

* clone source: `git clone git@github.com:asciimoo/searx.git && cd searx`
* install dependencies: `pip install -r requirements.txt`
* edit your [searx/settings.py](https://github.com/asciimoo/searx/blob/master/searx/settings.py) (set your `secret_key`!)
* rename `engines.cfg_sample` to `engines.cfg`
* edit your [settings.yml](https://github.com/asciimoo/searx/blob/master/settings.yml) (set your `secret_key`!)
* run `python searx/webapp.py` to start the application

For all the details, follow this [step by step installation](https://github.com/asciimoo/searx/wiki/Installation)

engines.cfg_sample

deleted100644 → 0
+0 −99
Original line number Diff line number Diff line
[wikipedia]
engine = mediawiki
url    = https://en.wikipedia.org/
number_of_results = 1

[bing]
engine = bing
locale = en-US

[currency]
engine=currency_convert
categories = general

[deviantart]
engine = deviantart
categories = images

[ddg definitions]
engine = duckduckgo_definitions

[duckduckgo]
engine = duckduckgo
locale = en-us

[filecrop]
engine = filecrop
categories = files

[flickr]
engine = flickr
categories = images

[github]
engine = github
categories = it

[google]
engine        = json_engine
search_url    = https://ajax.googleapis.com/ajax/services/search/web?v=2.0&start=0&rsz=large&safe=off&filter=off&q={query}
categories    = general
url_query     = /responseData/results/unescapedUrl
content_query = /responseData/results/content
title_query   = /responseData/results/titleNoFormatting

[google images]
engine = google_images
categories = images

[piratebay]
engine = piratebay
categories = videos, music, files

[soundcloud]
engine = soundcloud
categories = music

[stackoverflow]
engine = stackoverflow
categories = it

[startpage]
engine = startpage

[twitter]
engine = twitter
categories = social media

[urbandictionary]
engine        = xpath
search_url    = http://www.urbandictionary.com/define.php?term={query}
url_xpath     = //div[@class="word"]//a/@href
title_xpath   = //div[@class="word"]//a
content_xpath = //div[@class="definition"]

[yahoo]
engine           = xpath
search_url       = http://search.yahoo.com/search?p={query}
results_xpath    = //div[@class="res"]
url_xpath        = .//h3/a/@href
title_xpath      = .//h3/a
content_xpath    = .//div[@class="abstr"]
suggestion_xpath = //div[@id="satat"]//a

[youtube]
engine = youtube
categories = videos

[dailymotion]
engine = dailymotion
locale = en_US
categories = videos

[vimeo]
engine = vimeo
categories = videos
results_xpath = //div[@id="browse_content"]/ol/li
url_xpath=./a/@href
title_xpath=./a/div[@class="data"]/p[@class="title"]/text()
content_xpath=./a/img/@src
+1 −0
Original line number Diff line number Diff line
flask
grequests
lxml
pyyaml
+22 −0
Original line number Diff line number Diff line
from os import environ
from os.path import realpath, dirname, join
try:
    from yaml import load
except:
    from sys import exit, stderr
    stderr.write('[E] install pyyaml\n')
    exit(2)


searx_dir  = realpath(dirname(realpath(__file__))+'/../')
engine_dir = dirname(realpath(__file__))

if 'SEARX_SETTINGS_PATH' in environ:
    settings_path = environ['SEARX_SETTINGS_PATH']
else:
    settings_path = join(searx_dir, 'settings.yml')


with open(settings_path) as settings_yaml:
    settings = load(settings_yaml)
Loading