API文档
SearXNG Medical AI 提供RESTful API接口,支持JSON格式的搜索请求。
基础URL
http://localhost:8888
认证方式
API支持API Key认证,在请求头中添加:
X-API-Key: your-api-key
搜索接口
GET /search
参数
| 参数 | 类型 | 必需 | 描述 |
|---|---|---|---|
| q | string | 是 | 搜索查询 |
| format | string | 否 | 返回格式 (json/html/csv/rss) |
| engines | string | 否 | 搜索引擎列表 (逗号分隔) |
| language | string | 否 | 搜索语言 |
示例
curl "http://localhost:8888/search?q=医疗AI&format=json"
响应
{
"query": "医疗AI",
"number_of_results": 50,
"results": [
{
"url": "https://example.com",
"title": "医疗AI概述",
"content": "医疗AI是指...",
"engine": "google"
}
]
}
Python SDK
from api.searxng_api import SearXNGClient
client = SearXNGClient("http://localhost:8888")
# 百度搜索
results = client.search_baidu("医疗AI")
# 学术搜索
results = client.search_academic("artificial intelligence")
# 微信搜索
results = client.search_wechat("医疗AI")
JavaScript SDK
const client = new SearXNGClient('http://localhost:8888');
// 百度搜索
const results = await client.searchBaidu('医疗AI');
// 学术搜索
const academicResults = await client.searchAcademic('artificial intelligence');