这是一个基于EdgeOne国际版pages和函数的随机图API服务。
获取随机图片:
https://pic.166636.xyz/api/random
通过分类获取随机图片:
https://pic.166636.xyz/api/random?category=nature
<img src="https://pic.166636.xyz/api/random" alt="随机图片">
// 随机获取一张图片
fetch('https://pic.166636.xyz/api/random')
.then(response => response.blob())
.then(blob => {
const img = document.createElement('img');
img.src = URL.createObjectURL(blob);
document.body.appendChild(img);
});
点击下方按钮获取一张随机图片预览: