古诗词列表
GET
文学阅读
按分类获取古诗词列表,支持分页
GET
https://api.tinyaii.cn/v1/gushiwen/poems
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| category | string | 必填 | 分类ID(如 sanbai/tangshi/songci/quansong 等) | — |
| page | string | 可选 | 页码,默认1 | — |
返回字段
| 字段 | 类型 | 说明 |
|---|---|---|
| category | string | 分类ID |
| category_name | string | 分类名称 |
| page | string | 当前页码 |
| total | integer | 本页诗词数量 |
| poems | array | 诗词列表 |
| poems[].id | string | 诗词ID(用于获取详情) |
| poems[].title | string | 诗词标题 |
返回示例
{
"code": 200,
"data": {
"category": "sanbai",
"category_name": "唐诗三百首",
"page": "1",
"total": 277,
"poems": [
{
"id": "21c484c79935",
"title": "击壤歌"
},
{
"id": "4c5705b99143",
"title": "关雎"
}
]
}
}
调用示例
curl "https://api.tinyaii.cn/v1/gushiwen/poems?category=<category>" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch("https://api.tinyaii.cn/v1/gushiwen/poems?category=<category>", {
headers: { "Authorization": "Bearer YOUR_API_KEY" },
});
console.log(await res.json());import requests
resp = requests.get(
"https://api.tinyaii.cn/v1/gushiwen/poems",
params={"category": "<category>"},
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=10,
)
print(resp.json())把 YOUR_API_KEY 换成你的密钥即可直接运行。密钥只保存在你自己的设备上。