摘要:英雄聯盟聯賽統計在線接口文檔英雄聯盟接口,需注冊下英雄聯賽統計獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分成功中單中單中單上單上單輔助中單中單輔助輔助
英雄聯盟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}
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/76109.html
摘要:英雄聯盟的聯賽列表接口代碼示例,可注冊查看在線文檔英雄聯盟詳情頁聯賽列表獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分成功亞洲洲際賽亞洲洲際賽韓國首爾歐美洲際賽歐美洲際賽洛杉磯夏季賽夏季 英雄聯盟的【聯賽列表】接口代碼示例,可注冊查看在線文檔:英雄聯盟詳情頁 import com.alibaba.fastjson.JSON; impor...
摘要:之前調用過的聯賽數據在線接口文檔定義請求數據接口參數替換成自己的替換成自己的替換成請求對應數據的接口地址例如請求時間戳初始化請求接口參數調用電競數據接口獲取格式為字符串打印請求結果請求接口字符編碼返回字符串設置請求頭獲取當 之前調用過的DOTA聯賽數據 [https://www.feijing88.com/esport] import java.io.BufferedReader; i...
摘要:電競的聯賽列表接口,在線接口文檔聯賽列表獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分成功 電競CSGO的【聯賽列表】接口,在線接口文檔 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import java.ni...
摘要:電競的聯賽列表接口,在線接口文檔聯賽列表獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分成功 電競CSGO的【聯賽列表】接口,在線接口文檔 import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.annotation.JSONField; import java.ni...
閱讀 3428·2021-11-19 09:40
閱讀 1314·2021-10-11 11:07
閱讀 4844·2021-09-22 15:07
閱讀 2890·2021-09-02 15:15
閱讀 1964·2019-08-30 15:55
閱讀 539·2019-08-30 15:43
閱讀 883·2019-08-30 11:13
閱讀 1449·2019-08-29 15:36