注意
调用本站服务或在本站进行投稿,代表您已仔细阅读并同意使用条款。
本站管理员看过的百合作品有限,难免会有资源错误的情况,特别是壁纸更是重灾区(曾有过误将某后*游戏相关图片入库的严重错误)。如果您发现本站资源有任何错误,请联系support@ksar.cc。
请求地址生成
    返回编码: 
      
    
请求地址
GET https://v1.yurikoto.com/sentence
请求参数
| 参数 | 可选 | 说明 | 默认值 | 
|---|---|---|---|
| encode | 是 | 返回编码 | json | 
返回编码
| 参数 | 说明 | 
|---|---|
| text | 返回纯文本(只返回正文) | 
| json | 返回json | 
返回格式
| 参数 | 说明 | 
|---|---|
| status | 状态 | 
| id | 台词编号 | 
| content | 台词正文(utf-8) | 
| source | 台词来源 | 
状态
| 参数 | 状态码 | 说明 | 
|---|---|---|
| success | 200 | 成功 | 
| failed | 400 | 未知错误 | 
| failed | 403 | 非法访问 | 
| failed | 404 | 接口不存在 | 
| failed | 429 | 请求频率过高 | 
| failed | 500 | 服务端发生错误 | 
使用例
结合typed.js使用(本站首页实现)
var source;
var prefix = "From: ";
$.get("https://v1.yurikoto.com/sentence", function(data, status){
    try{
        source = prefix + data.source;
    }
    catch(e){};
    if(status == "success"){
        $("#source").text(source);
        var typed = new Typed("#sentence", {
            strings: [data.content],
            startDelay: 300,
            typeSpeed: 100,
            loop: true,
            backSpeed: 50,
            showCursor: true,
            onComplete: function(self){
                $.get("https://v1.yurikoto.com/sentence", function(data, status){
                    if(status == "success"){
                        try{
                            source = prefix + data.source;
                        }
                        catch(e){};
                        self.strings[0] = data.content;
                    }
                });
            },
            onLastStringBackspaced: function(self){
                $("#source").text(source);
            }
        });
    }
});