随机图片API演示
点击下方按钮获取随机图片
API响应数据
点击"获取随机图片"按钮后,API响应数据将显示在这里...
使用代码
fetch('https://img_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://img_api.yuubari.cn/api/random_image
获取随机图片并返回图片信息
响应格式
/api/random_image 响应
{
"image": {
"deleted": 0,
"file_path": "https://img_api.yuubari.cn/file/Yande.re/jpg/000/215/215840.jpg",
"format": ".jpg",
"height": 1080,
"name": "215840.jpg",
"original": 0,
"rating": "s",
"size": 3522517,
"source": "yande.re",
"source_id": "y215840",
"tags": [
"wallpaper",
"pantyhose",
"seifuku",
"cleavage",
"thighhighs",
"koizumi_amane",
"iizuki_tasuku",
"akino_subaru",
"fujikawa_runa",
"hatsukoi_1/1",
"makabe_midori",
"morino_yukino",
"tokizaki_maya",
"tone_work's",
"tsukishima_kyou"
],
"thumbnail_path": "https://img_api.yuubari.cn/thumbnail/jpg/215840.jpg",
"width": 1920
},
"status": "success"
}