Commit 1bede368 authored by Arnau Vàzquez's avatar Arnau Vàzquez
Browse files

Merge branch 'onesearch-engine' into 'master'

onesearch engine

Closes e/backlog#3676

See merge request e/cloud/my-spot!71
parents 2e7ce286 8c231bdc
from lxml.html import fromstring
import re
from searx.utils import (
from urllib.parse import unquote
# about
about = {
"website": '',
"wikidata_id": None,
"use_official_api": False,
"require_api_key": False,
"results": 'HTML',
# engine dependent config
categories = ['general']
paging = True
# search-url
URL = ';?p=%s&b=%d'
def request(query, params):
starting_from = (params['pageno'] * 10) - 9
params['url'] = URL % (query, starting_from)
return params
# get response from search-request
def response(resp):
results = []
doc = fromstring(resp.text)
titles_tags = eval_xpath(doc, '//div[contains(@class, "algo")]//h3[contains(@class, "title")]')
contents = eval_xpath(doc, '//div[contains(@class, "algo")]/div[contains(@class, "compText")]/p')
onesearch_urls = eval_xpath(doc, '//div[contains(@class, "algo")]//h3[contains(@class, "title")]/a/@href')
for title_tag, content, onesearch_url in zip(titles_tags, contents, onesearch_urls):
print(f"{title_tag.text_content()} ---> {onesearch_url}")
matches ='RU=(.*?)\/', onesearch_url)
'title': title_tag.text_content(),
'content': extract_text(content),
'url': unquote(,
return results
......@@ -1631,6 +1631,18 @@ engines:
require_api_key: false
results: HTML
- name: onesearch
shortcut: onesearch
engine: onesearch
paging: true
categories: general
wikidata_id: None
use_official_api: false
require_api_key: false
results: HTML
# Doku engine lets you access to any Doku wiki instance:
# A public one or a private/corporate one.
# - name : ubuntuwiki
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment