Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx-engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
searx-engine
Commits
8c260977
Unverified
Commit
8c260977
authored
Feb 23, 2020
by
Markus Heiser
Committed by
GitHub
Feb 23, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1842 from piplongrun/engine-etools
Add new eTools.ch engine
parents
90d23e7e
98322ac1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
etools.py
searx/engines/etools.py
+54
-0
settings.yml
searx/settings.yml
+5
-0
No files found.
searx/engines/etools.py
0 → 100644
View file @
8c260977
"""
eTools (Web)
@website https://www.etools.ch
@provide-api no
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, content
"""
from
lxml
import
html
from
searx.engines.xpath
import
extract_text
from
searx.url_utils
import
quote
from
searx.utils
import
eval_xpath
categories
=
[
'general'
]
paging
=
False
language_support
=
False
safesearch
=
True
base_url
=
'https://www.etools.ch'
search_path
=
'/searchAdvancedSubmit.do'
\
'?query={search_term}'
\
'&pageResults=20'
\
'&safeSearch={safesearch}'
def
request
(
query
,
params
):
if
params
[
'safesearch'
]:
safesearch
=
'true'
else
:
safesearch
=
'false'
params
[
'url'
]
=
base_url
+
search_path
.
format
(
search_term
=
quote
(
query
),
safesearch
=
safesearch
)
return
params
def
response
(
resp
):
results
=
[]
dom
=
html
.
fromstring
(
resp
.
text
)
for
result
in
eval_xpath
(
dom
,
'//table[@class="result"]//td[@class="record"]'
):
url
=
eval_xpath
(
result
,
'./a/@href'
)[
0
]
title
=
extract_text
(
eval_xpath
(
result
,
'./a//text()'
))
content
=
extract_text
(
eval_xpath
(
result
,
'.//div[@class="text"]//text()'
))
results
.
append
({
'url'
:
url
,
'title'
:
title
,
'content'
:
content
})
return
results
searx/settings.yml
View file @
8c260977
...
...
@@ -203,6 +203,11 @@ engines:
timeout
:
3.0
disabled
:
True
-
name
:
etools
engine
:
etools
shortcut
:
eto
disabled
:
True
-
name
:
etymonline
engine
:
xpath
paging
:
True
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment