抓了个语雀的AI接口

抓取两个参数

python

import requests

# 定义函数来设置Cookie
def set_cookie(headers, cookie_value,x_csrf_token):
    headers['Cookie'] = cookie_value
    headers['x-csrf-token'] = x_csrf_token

url = 'https://www.yuque.com/api/ai/ai_writing/completion'

headers = {
    'Content-Type': 'application/json',
}

# 设置Cookie
cookie_value = ''
x_csrf_token = ''
set_cookie(headers, cookie_value)

data = {
    "content": "介绍自己",
    "type": "custom",
    "stream": False,
    "http": True,
}

response = requests.post(url, headers=headers, json=data)
print(response.text)

java

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;

public class YuqueApiRequest {
    public static void main(String[] args) {
        String url = "https://www.yuque.com/api/ai/ai_writing/completion";

        JSONObject data = JSONUtil.createObj()
                .putOnce("content", "介绍自己")
                .putOnce("type", "custom")
                .putOnce("stream", false)
                .putOnce("http", true);

        String response = HttpRequest.post(url)
                .header("Content-Type", "application/json")
                .header("Cookie", "")
                .header("x-csrf-token", "")
                .body(data.toString())
                .execute()
                .body();

        System.out.println(response);
    }
}

真的好水水水水啊 :clown_face: 正好是饭点,给佬友们下饭

32 个赞

感谢你的分享

2 个赞

3b吗???

3 个赞

@bbb 我成你的分身了tieba_087

2 个赞

是的,他是我的小号

4 个赞

以后叫我1b

2 个赞

好的,1b,

2 个赞

太强了!大佬!

2 个赞

感谢大帅哥捧场

有点厉害支持~~

厉害了!大佬!

亲测可用,可惜有限额

语雀的AI应该就是通义千问吧

1 个赞