API v0图片示例

发布于 2022-09-06  70 次阅读


在页面底部部署脚本,在其他任何地方调用img元素。示例如下,可以自行修改

<img accesskey="01T4VX662ZD6FYMBQOTZHLIO3PAQHABVHN" class="api_img"></img>
<img accesskey="01T4VX664ECMQIPHI7HZGYG6DHH73AGE3D" class="api_img"></img>
<img accesskey="01T4VX664WW3CMWMLLNRFJJOPIQC3C6FKR" class="api_img"></img>
function img_load() {
    list = document.getElementsByClassName("api_img");
    for (var i = 0; i < list.length; i++) {
        one = list[i];
        img_on(one)
    }
}
function img_on(one){
    BASEURL = "https://api.phantom-sea-limited.ltd/release/API/get?api&thumbnails&id="
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            a = eval('(' + xhr.responseText + ')');
            console.log(a);
            try { one.src = a["thumbnail"] } catch { pass }
        }
    }
    xhr.open('GET', BASEURL + one.accessKey, true);
    xhr.send()
}
setTimeout("img_load()", 1000)
最后更新于 2022-09-23