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
442772a6
Commit
442772a6
authored
Dec 02, 2018
by
dimqua
Committed by
pofilo
Dec 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove findx engine (#1452)
parent
81db2e07
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
133 deletions
+0
-133
findx.py
searx/engines/findx.py
+0
-115
settings.yml
searx/settings.yml
+0
-18
No files found.
searx/engines/findx.py
deleted
100644 → 0
View file @
81db2e07
"""
FindX (General, Images, Videos)
@website https://www.findx.com
@provide-api no
@using-api no
@results HTML
@stable no
@parse url, title, content, embedded, img_src, thumbnail_src
"""
from
dateutil
import
parser
from
json
import
loads
import
re
from
lxml
import
html
from
searx
import
logger
from
searx.engines.xpath
import
extract_text
from
searx.engines.youtube_noapi
import
base_youtube_url
,
embedded_url
from
searx.url_utils
import
urlencode
paging
=
True
results_xpath
=
'//script[@id="initial-state"]'
search_url
=
'https://www.findx.com/{category}?{q}'
type_map
=
{
'none'
:
'web'
,
'general'
:
'web'
,
'images'
:
'images'
,
'videos'
:
'videos'
,
}
def
request
(
query
,
params
):
params
[
'url'
]
=
search_url
.
format
(
category
=
type_map
[
params
[
'category'
]],
q
=
urlencode
({
'q'
:
query
,
'page'
:
params
[
'pageno'
]
})
)
return
params
def
response
(
resp
):
dom
=
html
.
fromstring
(
resp
.
text
)
results_raw_json
=
dom
.
xpath
(
results_xpath
)
results_json
=
loads
(
extract_text
(
results_raw_json
))
if
len
(
results_json
[
'web'
][
'results'
])
>
0
:
return
_general_results
(
results_json
[
'web'
][
'results'
][
'webSearch'
][
'results'
])
if
len
(
results_json
[
'images'
][
'results'
])
>
0
:
return
_images_results
(
results_json
[
'images'
][
'results'
])
if
len
(
results_json
[
'video'
][
'results'
])
>
0
:
return
_videos_results
(
results_json
[
'video'
][
'results'
])
return
[]
def
_general_results
(
general_results
):
results
=
[]
for
result
in
general_results
:
results
.
append
({
'url'
:
result
[
'url'
],
'title'
:
result
[
'title'
],
'content'
:
result
[
'sum'
],
})
return
results
def
_images_results
(
image_results
):
results
=
[]
for
result
in
image_results
:
results
.
append
({
'url'
:
result
[
'sourceURL'
],
'title'
:
result
[
'title'
],
'content'
:
result
[
'source'
],
'thumbnail_src'
:
_extract_url
(
result
[
'assets'
][
'thumb'
][
'url'
]),
'img_src'
:
_extract_url
(
result
[
'assets'
][
'file'
][
'url'
]),
'template'
:
'images.html'
,
})
return
results
def
_videos_results
(
video_results
):
results
=
[]
for
result
in
video_results
:
if
not
result
[
'kind'
]
.
startswith
(
'youtube'
):
logger
.
warn
(
'Unknown video kind in findx: {}'
.
format
(
result
[
'kind'
]))
continue
description
=
result
[
'snippet'
][
'description'
]
if
len
(
description
)
>
300
:
description
=
description
[:
300
]
+
'...'
results
.
append
({
'url'
:
base_youtube_url
+
result
[
'id'
],
'title'
:
result
[
'snippet'
][
'title'
],
'content'
:
description
,
'thumbnail'
:
_extract_url
(
result
[
'snippet'
][
'thumbnails'
][
'default'
][
'url'
]),
'publishedDate'
:
parser
.
parse
(
result
[
'snippet'
][
'publishedAt'
]),
'embedded'
:
embedded_url
.
format
(
videoid
=
result
[
'id'
]),
'template'
:
'videos.html'
,
})
return
results
def
_extract_url
(
url
):
matching
=
re
.
search
(
'(/https?://[^)]+)'
,
url
)
if
matching
:
return
matching
.
group
(
0
)[
1
:]
return
''
searx/settings.yml
View file @
442772a6
...
...
@@ -218,24 +218,6 @@ engines:
shortcut
:
fd
disabled
:
True
-
name
:
findx
engine
:
findx
shortcut
:
fx
categories
:
general
disabled
:
True
-
name
:
findx images
engine
:
findx
shortcut
:
fxi
categories
:
images
disabled
:
True
-
name
:
findx videos
engine
:
findx
shortcut
:
fxv
categories
:
videos
disabled
:
True
-
name
:
flickr
categories
:
images
shortcut
:
fl
...
...
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