随机图片API演示
点击下方按钮获取随机图片
API响应数据
点击“获取随机图片”按钮后,API响应数据将显示在这里...
使用代码
fetch('https://api.yuubari.cn/api/random_image')
.then(response => {
return response.json();
})
.then(data => {
if (data.status === 'success') {
const imgUrl = data.image.file_path;
alert(`图片URL: ${imgUrl}`);
} else {
alert('获取图片失败:' + data.message);
}
})
.catch(error => {
console.error('请求出错:', error);
alert('网络请求出错,请稍后再试');
});
API文档
API接口
获取随机图片
GET https://api.yuubari.cn/api/random_image
获取随机图片并返回图片信息(公开接口,无需鉴权)
查询调用情况
GET https://api.yuubari.cn/api/random_image_status
返回当前小时窗口的调用用量与最近一次调用时间(公开接口,无需鉴权)
频度上限
- 每小时最多 20 次(窗口自首次调用起算,时长 1 小时)
- 超出上限返回
429,响应体含used/limit/reset_at
响应格式
/api/random_image 响应
{
"image": {
"deleted": 0,
"file_path": "https://api.yuubari.cn/static/waifus/Yande.re/jpg/000/319/319997.jpg",
"format": ".jpg",
"height": 1080,
"name": "319997.jpg",
"original": 0,
"rating": "s",
"size": 2377216,
"source": "yande.re",
"source_id": "y319997",
"tags": [
"azuki_azusa",
"hentai_ouji_to_warawanai_neko",
"kantoku",
"seifuku",
"thighhighs",
"wallpaper"
],
"thumbnail_path": "https://api.yuubari.cn/static/waifus/.thumbnail/jpg/319997.jpg",
"width": 1920
},
"status": "success"
}
/api/random_image_status 响应
{
"api_name": "random_image",
"last_invoke_time": "2026-10-05 20:42:34",
"limit": 20,
"remaining": 17,
"reset_at": "2026-10-05 21:10:05",
"status": "success",
"used": 3,
"window": "1h",
"window_start": "2026-10-05 20:10:05"
}
当前窗口调用情况
频度窗口:每小时上限 20 次(自首次调用起算)
本窗口已用
-
剩余可用
-
窗口开始
-
重置时间
-
最近一次调用:-