mirror of
https://github.com/searxng/searxng.git
synced 2026-06-22 17:48:33 +02:00
[feat] engines: add tusksearch (web, news, videos, images) (#6267)
The code that reads the value of variable `x` from `embed.js`, decodes
it to ASCII and based on that sets `window["tuskheader"]` and `window["tuskkey"]`
is attached below. The only real way to figure out what this is doing is
by stepping through it with the debugger, otherwise it's almost hopeless.
```js
function fe() {
const B = pe => pe.map(_e => String.fromCharCode(_e)).join(''),
ae = window,
o = ae.x;
if (o?.length) {
const pe = o.length / 2;
for (let _e = 0; _e < pe; _e++) ae[B(o[_e])] = B(o[pe + _e]);
ae.x = void 0
}
}
```
Minimal script for testing the engine:
```py
import random
from json import loads
import requests
resp = requests.get("https://api.tusksearch.com/revcontent/embed.js")
data = loads(resp.text[6:])
def _decode(text: list[int]) -> str:
return "".join([chr(x) for x in text])
header = _decode(data[3])
value = _decode(data[4])
resp = requests.get(
"https://api.tusksearch.com/Search/Web?q=test&p=1&l=center&nextArgs=&prevArgs=",
# "https://api.tusksearch.com/Search/Image?q=test&p=1&l=center",
headers={
header: value,
'x-lon': str(random.random() * 90),
'x-lat': str(random.random() * 90),
},
)
print(resp.text)
```
This commit is contained in:
@@ -2383,6 +2383,35 @@ engines:
|
||||
- 5000
|
||||
inactive: true
|
||||
|
||||
- name: tusksearch
|
||||
engine: tusksearch
|
||||
shortcut: tu
|
||||
tusk_categ: web
|
||||
categories: general
|
||||
disabled: true
|
||||
|
||||
- name: tusksearch images
|
||||
engine: tusksearch
|
||||
shortcut: tui
|
||||
paging: false
|
||||
tusk_categ: images
|
||||
categories: images
|
||||
disabled: true
|
||||
|
||||
- name: tusksearch videos
|
||||
engine: tusksearch
|
||||
shortcut: tuv
|
||||
tusk_categ: videos
|
||||
categories: videos
|
||||
disabled: true
|
||||
|
||||
- name: tusksearch news
|
||||
engine: tusksearch
|
||||
shortcut: tun
|
||||
tusk_categ: news
|
||||
categories: news
|
||||
disabled: true
|
||||
|
||||
# tmp suspended - too slow, too many errors
|
||||
# - name: urbandictionary
|
||||
# engine : xpath
|
||||
|
||||
Reference in New Issue
Block a user