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
f18f94a8
Unverified
Commit
f18f94a8
authored
Apr 20, 2020
by
Markus Heiser
Committed by
GitHub
Apr 20, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1923 from HLFH/master
Remove discontinued faroo engine
parents
0b7e7acf
9302d1fc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
101 deletions
+0
-101
faroo.py
searx/engines/faroo.py
+0
-96
settings.yml
searx/settings.yml
+0
-5
No files found.
searx/engines/faroo.py
deleted
100644 → 0
View file @
0b7e7acf
"""
Faroo (Web, News)
@website http://www.faroo.com
@provide-api yes (http://www.faroo.com/hp/api/api.html), require API-key
@using-api no
@results JSON
@stable yes
@parse url, title, content, publishedDate, img_src
"""
from
json
import
loads
import
datetime
from
searx.utils
import
searx_useragent
from
searx.url_utils
import
urlencode
# engine dependent config
categories
=
[
'general'
,
'news'
]
paging
=
True
language_support
=
True
number_of_results
=
10
# search-url
url
=
'http://www.faroo.com/'
search_url
=
url
+
'instant.json?{query}'
\
'&start={offset}'
\
'&length={number_of_results}'
\
'&l={language}'
\
'&src={categorie}'
\
'&i=false'
\
'&c=false'
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
]
# if language is not supported, put it in english
if
language
!=
'en'
and
\
language
!=
'de'
and
\
language
!=
'zh'
:
language
=
'en'
params
[
'url'
]
=
search_url
.
format
(
offset
=
offset
,
number_of_results
=
number_of_results
,
query
=
urlencode
({
'q'
:
query
}),
language
=
language
,
categorie
=
categorie
)
params
[
'headers'
][
'Referer'
]
=
url
return
params
# get response from search-request
def
response
(
resp
):
# HTTP-Code 429: rate limit exceeded
if
resp
.
status_code
==
429
:
raise
Exception
(
"rate limit has been exceeded!"
)
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'
]:
publishedDate
=
None
result_json
=
{
'url'
:
result
[
'url'
],
'title'
:
result
[
'title'
],
'content'
:
result
[
'kwic'
]}
if
result
[
'news'
]:
result_json
[
'publishedDate'
]
=
\
datetime
.
datetime
.
fromtimestamp
(
result
[
'date'
]
/
1000.0
)
# append image result if image url is set
if
result
[
'iurl'
]:
result_json
[
'template'
]
=
'videos.html'
result_json
[
'thumbnail'
]
=
result
[
'iurl'
]
results
.
append
(
result_json
)
# return results
return
results
searx/settings.yml
View file @
f18f94a8
...
...
@@ -219,11 +219,6 @@ engines:
shortcut
:
et
disabled
:
True
-
name
:
faroo
engine
:
faroo
shortcut
:
fa
disabled
:
True
-
name
:
1x
engine
:
www1x
shortcut
:
1x
...
...
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