猪
随机猪猪API
随机猪猪 API
一行代码获取随机猪猪图片,支持批量获取和直接跳转。
接口端点
GET
/api/random-pig返回一张随机猪图的 JSON 信息
响应示例
JSON
// 响应示例
{
"filename": "猪反转.jpg",
"title": "猪反转",
"url": "https://raw.githubusercontent.com/..."
}参数
| 参数 | 类型 | 说明 |
|---|---|---|
count | number (1-20) | 返回多张图片,默认 1 |
redirect | boolean | 为 true 时直接 302 跳转到图片(仅单张) |
使用示例
获取单张图片
GET /api/random-pig批量获取 5 张
GET /api/random-pig?count=5直接跳转到图片
GET /api/random-pig?redirect=true快速开始
在 HTML 中使用
HTML
<img
src="/api/random-pig?redirect=true"
alt="随机猪图"
/>