资讯专栏INFORMATION COLUMN

电竞数据API接口|英雄联盟lol|联赛统计|API调用示例代码

olle / 3007人阅读

摘要:英雄联盟联赛统计在线接口文档英雄联盟接口,需注册下英雄联赛统计获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分成功中单中单中单上单上单辅助中单中单辅助辅助

英雄联盟lol联赛统计在线接口文档:英雄联盟接口,需注册下

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
 
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
 
/**
 * @API: 英雄联赛统计
 * @Website: https://www.feijing88.com
 */
public class LolHero {
 
    public static void main(String[] args) {
        try {
            String content = getContent();
            Respond rsp = JSON.parseObject(content, Respond.class);
            System.out.println(rsp.code);
            System.out.println(rsp.message);
            rsp.getData().forEach(System.out::println);
 
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
 
    /**
     * 获取API返回内容
     * 

* Note: 这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容 */ private static String getContent() { try { StringBuilder builder = new StringBuilder(); List lines = Files.readAllLines(Paths.get("./src/main/resources/LolHero.json"), StandardCharsets.UTF_8); lines.forEach(builder::append); return builder.toString(); } catch (Throwable t) { t.printStackTrace(); return ""; } } public static class Respond { @JSONField private int code; @JSONField private String message; @JSONField private List data; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public List getData() { return data; } public void setData(List data) { this.data = data; } } public static class Hero { @JSONField private int heroId; @JSONField private int leagueId; @JSONField private double kda; @JSONField private double killAverage; @JSONField private double deathAverage; @JSONField private double assistAverage; @JSONField private String position; @JSONField private double pickRate; @JSONField private double banRate; @JSONField private double winRate; @Override public String toString() { return "Hero{" + "heroId=" + heroId + ", leagueId=" + leagueId + ", kda=" + kda + ", killAverage=" + killAverage + ", deathAverage=" + deathAverage + ", assistAverage=" + assistAverage + ", position="" + position + """ + ", pickRate=" + pickRate + ", banRate=" + banRate + ", winRate=" + winRate + "}"; } public void setHeroId(int heroId) { this.heroId = heroId; } public void setLeagueId(int leagueId) { this.leagueId = leagueId; } public void setKda(double kda) { this.kda = kda; } public void setKillAverage(double killAverage) { this.killAverage = killAverage; } public void setDeathAverage(double deathAverage) { this.deathAverage = deathAverage; } public void setAssistAverage(double assistAverage) { this.assistAverage = assistAverage; } public void setPosition(String position) { this.position = position; } public void setPickRate(double pickRate) { this.pickRate = pickRate; } public void setBanRate(double banRate) { this.banRate = banRate; } public void setWinRate(double winRate) { this.winRate = winRate; } } }

API 返回数据如下(部分):

200
成功
Hero{heroId=1, leagueId=51, kda=4.0, killAverage=0.2, deathAverage=0.1, assistAverage=0.3, position="中单", pickRate=5.882, banRate=0.0, winRate=71.429}
Hero{heroId=1, leagueId=51, kda=4.0, killAverage=0.2, deathAverage=0.1, assistAverage=0.3, position="中单", pickRate=5.882, banRate=0.0, winRate=71.429}
Hero{heroId=2, leagueId=51, kda=3.6, killAverage=0.0, deathAverage=0.1, assistAverage=0.2, position="中单", pickRate=1.681, banRate=0.0, winRate=50.0}
Hero{heroId=3, leagueId=51, kda=2.4, killAverage=0.1, deathAverage=0.1, assistAverage=0.2, position="上单", pickRate=5.882, banRate=0.0, winRate=57.143}
Hero{heroId=3, leagueId=51, kda=2.4, killAverage=0.1, deathAverage=0.1, assistAverage=0.2, position="上单", pickRate=5.882, banRate=0.0, winRate=57.143}
Hero{heroId=4, leagueId=51, kda=3.0, killAverage=0.2, deathAverage=1.0, assistAverage=2.9, position="辅助", pickRate=42.017, banRate=52.941, winRate=56.0}
Hero{heroId=6, leagueId=51, kda=15.0, killAverage=0.0, deathAverage=0.0, assistAverage=0.1, position="中单", pickRate=0.84, banRate=3.361, winRate=100.0}
Hero{heroId=8, leagueId=51, kda=2.4, killAverage=0.0, deathAverage=0.0, assistAverage=0.1, position="ADC", pickRate=1.681, banRate=0.84, winRate=0.0}
Hero{heroId=10, leagueId=51, kda=6.8, killAverage=0.2, deathAverage=0.1, assistAverage=0.3, position="中单", pickRate=6.723, banRate=2.521, winRate=62.5}
Hero{heroId=11, leagueId=51, kda=1.5, killAverage=0.0, deathAverage=0.0, assistAverage=0.0, position="辅助", pickRate=0.84, banRate=0.0, winRate=0.0}
Hero{heroId=13, leagueId=51, kda=2.4, killAverage=0.0, deathAverage=0.0, assistAverage=0.1, position="ADC", pickRate=0.84, banRate=0.0, winRate=0.0}
Hero{heroId=14, leagueId=51, kda=3.4, killAverage=0.1, deathAverage=0.6, assistAverage=2.0, position="辅助", pickRate=28.571, banRate=9.244, winRate=50.0}
Hero{heroId=15, leagueId=51, kda=10.0, killAverage=0.0, deathAverage=0.0, assistAverage=0.1, position="ADC", pickRate=0.84, banRate=0.0, winRate=0.0}

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/76109.html

相关文章

  • 电竞数据API接口 - 【英雄联盟联赛列表】API调用示例代码

    摘要:英雄联盟的联赛列表接口代码示例,可注册查看在线文档英雄联盟详情页联赛列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分成功亚洲洲际赛亚洲洲际赛韩国首尔欧美洲际赛欧美洲际赛洛杉矶夏季赛夏季 英雄联盟的【联赛列表】接口代码示例,可注册查看在线文档:英雄联盟详情页 import com.alibaba.fastjson.JSON; impor...

    amc 评论0 收藏0
  • 电竞DOTA2联赛数据api示例代码

    摘要:之前调用过的联赛数据在线接口文档定义请求数据接口参数替换成自己的替换成自己的替换成请求对应数据的接口地址例如请求时间戳初始化请求接口参数调用电竞数据接口获取格式为字符串打印请求结果请求接口字符编码返回字符串设置请求头获取当 之前调用过的DOTA联赛数据 [https://www.feijing88.com/esport] import java.io.BufferedReader; i...

    luckyw 评论0 收藏0
  • 电竞CSGO数据API接口 - 【联赛列表】API调用示例代码

    摘要:电竞的联赛列表接口,在线接口文档联赛列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分成功 电竞CSGO的【联赛列表】接口,在线接口文档 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import java.ni...

    microelec 评论0 收藏0
  • 电竞CSGO数据API接口 - 【联赛列表】API调用示例代码

    摘要:电竞的联赛列表接口,在线接口文档联赛列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分成功 电竞CSGO的【联赛列表】接口,在线接口文档 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import java.ni...

    BaronZhang 评论0 收藏0

发表评论

0条评论

olle

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<