java爬虫使用Jsoup

java 复制代码
     try {
//            拿到当前剩余余下的钱
            Document doc = Jsoup.connect(url)
                    .header("Authorization", "Bearer " + apiKey)
                    .header("Content-Type", "application/json")
                    .header("Connection", "keep-alive")
                    .data("type", "draw")  // 添加form-data参数
                    .requestBody("""
                             {"name":11,
                             "password":22
                             }
                             """)  //添加body参数
                    .ignoreContentType(true) //忽略所有请求参数
                    .ignoreHttpErrors(true) //忽略所有异常
                    .timeout(200000)
                    .get();



//                拿到一共剩余
            String html = doc.text(); // 获取HTML代码
            JSONObject json =JSONObject.parseObject(html); // 将HTML代码转换为JSON对象
            String total_granted = json.getString("total_granted"); // 一共

配置上面参数最后转换成json格式就可以使用了 对应的jar包可以问我的ai

https://0.00000.work

相关推荐
hhb_61820 小时前
Dylan 语言核心特性与工程实践深度解析
开发语言·c#
CSharp精选营20 小时前
最新.NET新手入门学习网站合集(2026更新版)
c#·学习资料·开发教程·.net 新手入门·开放资源·.net网站
hhb_6181 天前
C#高性能异步编程实战与底层原理深度解析
开发语言·c#
beyond谚语1 天前
反射、特性和依赖注入
c#
Tiger_shl1 天前
C# 托管对象、非托管对象 讲解
开发语言·c#
LF男男1 天前
Action- C# 内置的委托类型
java·开发语言·c#
2501_930707781 天前
使用C#代码在 PowerPoint 中创建组合图表
开发语言·c#·powerpoint
Full Stack Developme1 天前
Hutool DFA 教程
开发语言·c#
xiaoshuaishuai81 天前
【无标题】
开发语言·windows·c#
SunnyDays10111 天前
C# 如何快速比较 Word 文档并显示差异
c#·对比 word 文档·比较 word 文档