API 文档
此 API 旨在提供对指定网站的 HTTP 状态检查以及敏感词检测功能。它允许客户端提交一个或多个 URL,并选择一个或多个敏感词库文件进行内容审查。该 API 还支持验证客户端凭据,以确保只有授权用户能够访问其功能。
端点
获取敏感词库信息
方法: GET
URL: https://safesite.rutno.com/check_url_api?getSources=true
说明: 返回可用的敏感词库列表及其描述信息。
请求参数 (GET)
| 参数名 | 类型 | 必须 | 描述 |
|---|---|---|---|
| getSources | bool | 是 | 设置为 true 以获取敏感词库列表 |
成功响应
{
"sources": [
{
"name": "违禁词汇库1",
"description": "这是第一个违禁词汇库。",
"file": "wg.txt"
},
{
"name": "违禁词汇库2",
"description": "这是第二个违禁词汇库。",
"file": "wg2.txt"
}
]
}
示例请求
curl "https://safesite.rutno.com/check_url_api?getSources=true"
提交域名进行检查
方法: POST
URL: https://safesite.rutno.com/check_url_api
请求体: JSON 格式的数据,包含 secret_id, secret_key, domains, 和可选的 sources 字段。
请求参数 (POST)
| 参数名 | 类型 | 必须 | 描述 |
|---|---|---|---|
| secret_id | string | 是 | 客户端的唯一标识符 |
| secret_key | string | 是 | 客户端的密钥 |
| domains | array | 是 | 需要检查的一个或多个域名列表 |
| sources | array | 否 | 敏感词库文件名列表,默认使用所有敏感词库 |
成功响应
正常情况
{
"https://example1.com": {
"status": 200,
"safe": true,
"message": "Website is accessible and functioning normally."
},
"https://example2.com": {
"status": 404,
"message": "The requested page could not be found on the website."
}
}
包含违禁词汇
{
"https://example3.com": {
"status": 200,
"safe": false,
"message": "Website contains prohibited words.",
"prohibited_words": ["word1", "word2"]
}
}
错误响应
{
"error": "Invalid credentials or client is banned"
}
{
"error": "Insufficient requests quota"
}
示例请求
curl -X POST "https://safesite.rutno.com/check_url_api" \
-H "Content-Type: application/json" \
--data-raw '{
"secret_id": "zko_client",
"secret_key": "a_very_strong_secret_key",
"domains": ["https://example1.com", "https://example2.com"],
"sources": ["wg.txt", "wg2.txt"]
}'
注意事项
- 所有请求必须通过 HTTPS 发送。
- POST 请求需要在头部设置 Content-Type: application/json。
- 对于每个请求,都会根据 secret_id 和 secret_key 验证客户端的有效性。
- 如果客户端的剩余请求次数不足,则会返回相应的错误信息。
- 当检查网站时,如果网站不可达或者返回非 200 状态码(如 404、503 等),将直接返回相应的状态码及消息,不会进一步检查敏感词。