Jinghuashang - 二次元随机图API食用说明

不来这里抽个卡嘛~( •̀ ω •́ )y → Gacha

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

随机图API及图床均不保障使用体验和稳定性

食用方法

API地址:https://imgapi.jinghuashang.cn/random
调用方法:GET

传入参数说明:

键描述 值类型 可用的值 值描述
sort 索引的图片集
(可选,默认为approve)
Text random
sp
huaming
索引全部图片
索引横屏壁纸
索引花铭老师的图片 版权原因 暂时关闭
type 输出方法
(可选,默认为重定向)
Text text
json
输出文本
输出JSON格式
num 输出图片数量
(可选,当num大于1时type固定为json)
Integer 小于等于100的任意正整数
若不携带num则默认为1
thumbnail 使用缩略图(失效) Text large
medium
small
最长边重设为800px
最长边重设为176px
最长边重设为96px
only_check 检查可用额度
(可选,当此参数为任意真值时其它参数无效)
Any 任意真值,或不携带此参数

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

Demo:

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

返回参数说明:

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

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

将随机图API设置为网页背景

Demo(CSS):

html:before {
    background: url(https://imgapi.jinghuashang.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.jinghuashang.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.jinghuashang.cn/player
调用方法:GET

传入参数说明:

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

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

Demo(HTML):

<iframe src="https://imgapi.jinghuashang.cn/player?time=10" style="position:fixed;top:0;left:0;width:100%;height:100%;z-index:-1;border:none;overflow:hidden;"></iframe>