古诗词列表

按分类获取古诗词列表,支持分页

GET https://api.tinyaii.cn/v1/gushiwen/poems

请求参数

参数名类型必填说明示例
categorystring必填分类ID(如 sanbai/tangshi/songci/quansong 等)—
pagestring可选页码,默认1—

返回字段

字段类型说明
categorystring分类ID
category_namestring分类名称
pagestring当前页码
totalinteger本页诗词数量
poemsarray诗词列表
poems[].idstring诗词ID(用于获取详情)
poems[].titlestring诗词标题

返回示例

{
  "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 换成你的密钥即可直接运行。密钥只保存在你自己的设备上。