欢迎使用关键词管理系统API!本文档提供完整的API接口说明和使用示例。
https://hub.jp.to4.cn/api//api/generate.php
根据域名和关键词分类生成唯一的网站标题。系统会自动选择该域名尚未使用过的关键词,并确保每个域名不会获得重复的标题。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
domain |
string | 必填 | 域名,例如:example.com |
category |
string | 可选 | 关键词分类名称,不指定则从所有分类中随机选择 |
{
"success": true,
"data": {
"title": "人工智能 - 专业科技服务平台",
"keyword": "人工智能",
"category": "科技",
"domain": "example.com"
}
}
{
"success": false,
"error": "没有可用的关键词",
"code": "NO_KEYWORDS",
"message": "建议: 1) 添加更多关键词 2) 不指定分类参数"
}
| 错误代码 | 说明 |
|---|---|
MISSING_DOMAIN |
缺少必填参数 domain |
NO_KEYWORDS |
没有可用的关键词(该域名已用完所有关键词或指定分类下无关键词) |
GENERATION_FAILED |
标题生成失败(AI服务异常) |
INTERNAL_ERROR |
服务器内部错误 |
# 不指定分类
curl "https://hub.jp.to4.cn/api/generate.php?domain=example.com"
# 指定分类
curl "https://hub.jp.to4.cn/api/generate.php?domain=example.com&category=科技"
<?php
$domain = 'example.com';
$category = '科技';
$url = "https://hub.jp.to4.cn/api/generate.php";
$url .= "?domain=" . urlencode($domain) . "&category=" . urlencode($category);
$response = file_get_contents($url);
$data = json_decode($response, true);
if ($data['success']) {
echo "生成的标题: " . $data['data']['title'];
echo "\n关键词: " . $data['data']['keyword'];
echo "\n分类: " . $data['data']['category'];
} else {
echo "错误: " . $data['error'];
}
?>
// 使用 Fetch API
fetch('https://hub.jp.to4.cn/api/generate.php?domain=example.com&category=科技')
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('标题:', data.data.title);
console.log('关键词:', data.data.keyword);
console.log('分类:', data.data.category);
} else {
console.error('错误:', data.error);
}
})
.catch(error => console.error('请求失败:', error));
// 使用 jQuery
$.ajax({
url: 'https://hub.jp.to4.cn/api/generate.php',
data: {
domain: 'example.com',
category: '科技'
},
success: function(data) {
if (data.success) {
console.log('标题:', data.data.title);
} else {
console.error('错误:', data.error);
}
}
});
import requests
import json
url = "https://hub.jp.to4.cn/api/generate.php"
params = {
'domain': 'example.com',
'category': '科技'
}
response = requests.get(url, params=params)
data = response.json()
if data['success']:
print(f"标题: {data['data']['title']}")
print(f"关键词: {data['data']['keyword']}")
print(f"分类: {data['data']['category']}")
else:
print(f"错误: {data['error']}")