动漫一言

挺不错

API文档
在线测试
代码示例

接口信息

请求参数说明

名称 必填 类型 说明
type string 可填写json/text默认为text

返回示例

{
    "code": "1",
    "text": "自来也:所以我才带这他,我才不要宇智波什么的小子,培养一个与生俱来的天才一点意思也没有。——岸本齐史"
}

在线测试工具

请求参数

状态:
响应时间: ms

代码示例

PHP
JavaScript
Python
Java
Go
C
C++
C#
<?php
$url = "https://api.lolimi.cn/API/dmyiyan/api.php";

// 请求参数
$type = "示例值"; // 可填写json/text默认为text

// 构建查询字符串
$query = http_build_query([
    'type' => $type,
]);

 =  . '?' . $query;

// 初始化cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $fullUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'get/post');

// 执行请求
$response = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

// 输出结果
echo $response;
?>
// 使用Fetch API\nconst url = "https://api.lolimi.cn/API/dmyiyan/api.php";

// 请求参数
const params = {
    type: '示例值', // 可填写json/text默认为text
};

// 构建查询字符串
const query = new URLSearchParams(params).toString();
const fullUrl = url + '?' + query;

// 发送请求
fetch(fullUrl, {
    method: 'get/post',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
    },
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
import requests\nurl = "https://api.lolimi.cn/API/dmyiyan/api.php"

# 请求参数
params = {
    'type': '示例值',  # 可填写json/text默认为text
}

# 发送请求
response = requests.get/post(url, data=params)

# 输出结果
print(response.json())
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) throws Exception {
        String url = "https://api.lolimi.cn/API/dmyiyan/api.php";

        // 请求参数
        String params = "";\n        params += "type=" + URLEncoder.encode("示例值", "UTF-8") + "&";  // 可填写json/text默认为text
        params = params.substring(0, params.length() - 1);

        // 创建连接
        HttpURLConnection conn = (HttpURLConnection) new URL(url + "?" + params).openConnection();
        conn.setRequestMethod("get/post");

        // 获取响应
        int responseCode = conn.getResponseCode();
        String response = new BufferedReader(new InputStreamReader(conn.getInputStream()))
                .lines().collect(Collectors.joining("\n"));

        // 输出结果
        System.out.println(response);
    }
}
package main

import (
    "bytes"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
)

func main() {
    apiUrl := "https://api.lolimi.cn/API/dmyiyan/api.php"

    // 请求参数
    data := url.Values{}
    data.Set("type", "示例值")  // 可填写json/text默认为text

    // 创建请求
    req, err := http.NewRequest("get/post", apiUrl, bytes.NewBufferString(data.Encode()))
    req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    // 读取响应
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println(string(body))
}
#include &lt;stdio.h>
#include &lt;curl/curl.h>

int main() {
    CURL *curl;
    CURLcode res;
    
    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "get/post");
        
        // 构建查询字符串
        char url[512] = "https://api.lolimi.cn/API/dmyiyan/api.php?";
        char type[32] = "示例值";  // 可填写json/text默认为text
        strcat(url, "type=");
        strcat(url, type);
        curl_easy_setopt(curl, CURLOPT_URL, url);

        // 执行请求
        res = curl_easy_perform(curl);
        if(res != CURLE_OK)
            fprintf(stderr, "请求失败: %s\n", curl_easy_strerror(res));

        curl_easy_cleanup(curl);
    }
    return 0;
}
#include &lt;iostream>
#include &lt;curl/curl.h>

size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp) {
    ((std::string*)userp)->append((char*)contents, size * nmemb);
    return size * nmemb;
}

int main() {
    CURL* curl;
    CURLcode res;
    std::string readBuffer;
    
    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "get/post");
        
        // 构建查询字符串
        std::string url = "https://api.lolimi.cn/API/dmyiyan/api.php?";
        std::string type = "示例值";  // 可填写json/text默认为text
        url += "type=" + type;
        curl_easy_setopt(curl, CURLOPT_URL, url.c_str());

        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
        
        // 执行请求
        res = curl_easy_perform(curl);
        if(res != CURLE_OK) {
            std::cerr << "请求失败: " << curl_easy_strerror(res) << std::endl;
        } else {
            std::cout << readBuffer << std::endl;
        }
        
        curl_easy_cleanup(curl);
    }
    return 0;
}
using System;
using System.Net;
using System.Text;

class Program
{
    static void Main()
    {
        // 请求参数
        var parameters = new System.Collections.Specialized.NameValueCollection();
        parameters.Add("type", "示例值");  // 可填写json/text默认为text

        using (var client = new WebClient())
        {
            client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
            
            // 发送请求

            var response = client.UploadValues("https://api.lolimi.cn/API/dmyiyan/api.php", "get/post", parameters);
            Console.WriteLine(Encoding.UTF8.GetString(response));
        }
    }
}