跳至主要內容

铭心石刻二次元随机图API

盒子先生大约 3 分钟约 1004 字资料API...

相关信息

铭心石刻 - 二次元随机图API食用说明
访问原文open in new window🙏

远道而来的你世界第一可爱!
不来这里抽个卡嘛~( •̀ ω •́ )y → Gachaopen in new window

本随机图API基于Kousekiopen in new window 自主上传的数据,图片绿色健康(不完全)

随机图API及图床均为保障使用体验和稳定性,API有一定的调用限制,具体见下文

食用方法
API地址:https://imgapi.kouseki.cn/randomopen in new window
调用方法:GET

速率和每日额度限制说明:
API限制:每IP每5秒内可以调用3次API,超出返回429

此外,请注意,每个IP每24小时内仅可通过API获取5000张图片
达到限度后将无法使用API,API地址返回状态码403并给出恢复时间

您可以 访问这里open in new window 以在不消耗额度的情况下查询您IP的剩余可用额度或可用额度恢复倒计时

传入参数说明:

键描述值类型可用的值值描述
sort索引的图片集
(可选,默认为approve)
Textrandom
approve
top
cat
yin
mp
pc
tuzi
索引全部图片
索引过审图片 (76268P) 暂时关闭
索引精选图片 (3945P) 暂时关闭
索引兽耳图片 (2510P) 暂时关闭
索引银发图片 (2060P) 暂时关闭
索引竖屏壁纸 (1813P)
索引横屏壁纸 (1770P)
索引点兔图片 (2384P) 暂时关闭
type输出方法
(可选,默认为重定向)
Texttext
json
输出文本
输出JSON格式
num输出图片数量
(可选,当num大于1时type固定为json)
Integer-小于等于100的任意正整数
若不携带num则默认为1
thumbnail使用缩略图(失效)Textlarge
medium
small
最长边重设为800px
最长边重设为176px
最长边重设为96px
only_check检查可用额度(可选,当此参数为任意真值时其它参数无效)Any-任意真值,或不携带此参数

Note:
更新时间:2023年6月29日(UTC+0)
图片审核使用 阿里云内容安全API
图片均来自互联网,来源众多无法确认版权信息,侵删

Demo:

GET https://imgapi.kouseki.cn/random
GET https://imgapi.kouseki.cn/random?thumbnail=large
GET https://imgapi.kouseki.cn/random?sort=top
GET https://imgapi.kouseki.cn/random?sort=cat&type=text
GET https://imgapi.kouseki.cn/random?sort=yin&num=100
GET https://imgapi.kouseki.cn/random?only_check=true

返回参数说明:
注意:当携带num参数且num参数大于等于2时,API只会输出JSON格式

传入type返回值Demo
text图片URLhttps://gitcode.net/RedStone_Kun/apicx/raw/master/imgs/moe/52b698e4f4256d50bb8af7a0b90895207907806.webpopen in new window
jsonpic: 图片URL(s)数组
remain_num: 剩余额度
{
"pic": ["https://gitcode.net/RedStone_Kun/apicx/raw/master/imgs/moe/52b698e4f4256d50bb8af7a0b90895207907806.webpopen in new window"],
"remain_num": 2333
}
其它重定向到图片URL

将随机图API设置为网页背景
Demo(CSS):

html:before {
    background: url(https://imgapi.kouseki.cn/random) no-repeat center 0/cover;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    content: "";
}

为了避免页面加载被过大的背景图阻塞导致加载缓慢,也可换用下面的方法

Demo(HTML):

<style>
.withBg:before {
    background: url(https://imgapi.kouseki.cn/random) no-repeat center 0/cover;
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    content: "";
}
</style>
<script>window.onload = () => document.documentElement.classList.add("withBg");</script>

一个输出壁纸轮播HTML的API
API地址:https://imgapi.kouseki.cn/playeropen in new window
调用方法:GET

传入参数说明:

键描述值类型值描述
time每张图片的持续时间,单位为秒(可选,默认为10)Integer大于等于5的任意正整数若不携带time则默认为5

以下是在网页中插入随机轮播背景的使用例

Demo(HTML):

<iframe src="https://imgapi.kouseki.cn/player?time=10" style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:-1;border:none;overflow:hidden;"></iframe>
上次编辑于:
贡献者: Mr.Box
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度