mirror of
https://github.com/searxng/searxng.git
synced 2026-06-22 17:48:33 +02:00
Compare commits
2 Commits
300695de5c
...
7159b8aed3
| Author | SHA1 | Date | |
|---|---|---|---|
| 7159b8aed3 | |||
| 246f5a5499 |
@@ -45,7 +45,7 @@ about = {
|
|||||||
base_url = "https://api2.marginalia-search.com"
|
base_url = "https://api2.marginalia-search.com"
|
||||||
safesearch = True
|
safesearch = True
|
||||||
categories = ["general"]
|
categories = ["general"]
|
||||||
paging = False
|
paging = True
|
||||||
results_per_page = 20
|
results_per_page = 20
|
||||||
api_key = None
|
api_key = None
|
||||||
"""To get an API key, please follow the instructions from `Key and license`_
|
"""To get an API key, please follow the instructions from `Key and license`_
|
||||||
@@ -85,7 +85,12 @@ class ApiSearchResults(t.TypedDict):
|
|||||||
|
|
||||||
def request(query: str, params: dict[str, t.Any]):
|
def request(query: str, params: dict[str, t.Any]):
|
||||||
|
|
||||||
query_params = {"count": results_per_page, "nsfw": min(params["safesearch"], 1), "query": query}
|
query_params = {
|
||||||
|
"page": params["pageno"],
|
||||||
|
"count": results_per_page,
|
||||||
|
"nsfw": min(params["safesearch"], 1),
|
||||||
|
"query": query,
|
||||||
|
}
|
||||||
|
|
||||||
params["url"] = f"{base_url}/search?{urlencode(query_params)}"
|
params["url"] = f"{base_url}/search?{urlencode(query_params)}"
|
||||||
params["headers"]["User-Agent"] = searxng_useragent()
|
params["headers"]["User-Agent"] = searxng_useragent()
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
"""Svgrepo (icons)"""
|
|
||||||
|
|
||||||
from lxml import html
|
|
||||||
from searx.utils import extract_text, eval_xpath, eval_xpath_list
|
|
||||||
|
|
||||||
about = {
|
|
||||||
"website": 'https://www.svgrepo.com',
|
|
||||||
"official_api_documentation": 'https://svgapi.com',
|
|
||||||
"use_official_api": False,
|
|
||||||
"require_api_key": False,
|
|
||||||
"results": 'HTML',
|
|
||||||
}
|
|
||||||
|
|
||||||
paging = True
|
|
||||||
categories = ['images', 'icons']
|
|
||||||
base_url = "https://www.svgrepo.com"
|
|
||||||
|
|
||||||
results_xpath = "//div[@class='style_nodeListing__7Nmro']/div"
|
|
||||||
url_xpath = ".//a/@href"
|
|
||||||
title_xpath = ".//a/@title"
|
|
||||||
img_src_xpath = ".//img/@src"
|
|
||||||
|
|
||||||
|
|
||||||
def request(query, params):
|
|
||||||
params['url'] = f"{base_url}/vectors/{query}/{params['pageno']}/"
|
|
||||||
return params
|
|
||||||
|
|
||||||
|
|
||||||
def response(resp):
|
|
||||||
results = []
|
|
||||||
|
|
||||||
dom = html.fromstring(resp.text)
|
|
||||||
for result in eval_xpath_list(dom, results_xpath):
|
|
||||||
results.append(
|
|
||||||
{
|
|
||||||
'template': 'images.html',
|
|
||||||
'url': base_url + extract_text(eval_xpath(result, url_xpath)),
|
|
||||||
'title': extract_text(eval_xpath(result, title_xpath)).replace(" SVG File", "").replace("Show ", ""),
|
|
||||||
'img_src': extract_text(eval_xpath(result, img_src_xpath)),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return results
|
|
||||||
@@ -2548,12 +2548,6 @@ engines:
|
|||||||
results: HTML
|
results: HTML
|
||||||
language: de
|
language: de
|
||||||
|
|
||||||
- name: svgrepo
|
|
||||||
engine: svgrepo
|
|
||||||
shortcut: svg
|
|
||||||
timeout: 10.0
|
|
||||||
disabled: true
|
|
||||||
|
|
||||||
- name: tootfinder
|
- name: tootfinder
|
||||||
engine: tootfinder
|
engine: tootfinder
|
||||||
shortcut: toot
|
shortcut: toot
|
||||||
|
|||||||
Reference in New Issue
Block a user