Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Can i add new engine #2171

Closed
andrew6838 opened this issue Sep 3, 2020 · 6 comments
Closed

Can i add new engine #2171

andrew6838 opened this issue Sep 3, 2020 · 6 comments
Labels

Comments

@andrew6838
Copy link

Hi all,

Can i add new engine ? How?

Thanks

@unixfox
Copy link
Member

unixfox commented Sep 4, 2020

If the instance is very easy to add through a single xpath that will fetch the results then you just need to add another block in the engine section of settings.yml file: https://searx.github.io/searx/admin/settings.html#engine-settings

But if that's not the case then you need to write the new engine in python. You can take an engine from there: https://github.com/searx/searx/tree/master/searx/engines as an example. Unfortunately there is no perfect example, maybe @dalf could suggest you one.

In general the engine documentation is available here: https://searx.github.io/searx/dev/engine_overview.html

@dalf
Copy link
Contributor

dalf commented Sep 4, 2020

I don't have any special recommendation.

In addition to the exist documentation, note that there are (at least) two types of engine:

  • engine dealing with HTML or XML: in this case the engine relies on lxml to parse the HTML/XML page(s). See digg.py for an example.
  • engine dealing with JSON: in this case the engine relies on json. See github.py for an example.

@dalf dalf added the question label Sep 4, 2020
@andrew6838
Copy link
Author

andrew6838 commented Sep 4, 2020

If the instance is very easy to add through a single xpath that will fetch the results then you just need to add another block in the engine section of settings.yml file: https://searx.github.io/searx/admin/settings.html#engine-settings

But if that's not the case then you need to write the new engine in python. You can take an engine from there: https://github.com/searx/searx/tree/master/searx/engines as an example. Unfortunately there is no perfect example, maybe @dalf could suggest you one.

In general the engine documentation is available here: https://searx.github.io/searx/dev/engine_overview.html

on setting.yml:

  • name : baidu
    engine : baidu
    shortcut : ba

I copy someone's engine baidu.py and uploaded to engine folder

but it doesn't work. got 502 Bad Gateway

@dalf
Copy link
Contributor

dalf commented Sep 4, 2020

I uploaded baidu.py

Which code ? Where ? Why not your instance ? How was it installed ?
BTW: how your code is different from https://github.com/entropage/mijisou/blob/devel/searx/engines/baidu.py ?

but doesn't work.

Please please please, provide more context (errors messages, how do you get error, is it always / sometimes ?). doesn't work can mean anything. Sometimes just trying to write a bug report you may find what is wrong.

[EDIT] 502 Bad Gateway, it can be a problem about the instance, without more information, we can't help you.

@andrew6838
Copy link
Author

I uploaded baidu.py

Which code ? Where ? Why not your instance ? How was it installed ?
BTW: how your code is different from https://github.com/entropage/mijisou/blob/devel/searx/engines/baidu.py ?
its same..

but doesn't work.

Please please please, provide more context (errors messages, how do you get error, is it always / sometimes ?). doesn't work can mean anything. Sometimes just trying to write a bug report you may find what is wrong.

[EDIT] 502 Bad Gateway, it can be a problem about the instance, without more information, we can't help you.

@DitaAjiPratama
Copy link

I add python file for a new engine and place it in /searx/engines and restart uwsgi. What is the next step after that?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants