资讯专栏INFORMATION COLUMN

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

BaronZhang / 2691人阅读

摘要:电竞的联赛列表接口,在线接口文档联赛列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分成功

电竞CSGO的【联赛列表】接口,在线接口文档

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 CsgoLeague {
 
    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.getLeagueList().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/CsgoLeague.json"), StandardCharsets.UTF_8); lines.forEach(builder::append); return builder.toString(); } catch (Throwable t) { t.printStackTrace(); return ""; } } public static class Respond { @JSONField(name = "code") private int code; @JSONField(name = "message") private String message; @JSONField(name = "data") private List leagueList; 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 getLeagueList() { return leagueList; } public void setLeagueList(List leagueList) { this.leagueList = leagueList; } } public static class League { @JSONField(name = "league_id") private int leagueId; @JSONField(name = "logo") private String logo; @JSONField(name = "name") private String name; @JSONField(name = "country") private String country; @JSONField(name = "location") private String location; @JSONField(name = "start_time") private long startTime; @JSONField(name = "end_time") private long endTime; @JSONField(name = "team_ids") private List teamIds; @JSONField(name = "status") private int status; @Override public String toString() { return "League{" + "leagueId=" + leagueId + ", logo="" + logo + """ + ", name="" + name + """ + ", country="" + country + """ + ", location="" + location + """ + ", startTime=" + startTime + ", endTime=" + endTime + ", teamIds=" + teamIds + ", status=" + status + "}"; } public int getLeagueId() { return leagueId; } public void setLeagueId(int leagueId) { this.leagueId = leagueId; } public String getLogo() { return logo; } public void setLogo(String logo) { this.logo = logo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public long getStartTime() { return startTime; } public void setStartTime(long startTime) { this.startTime = startTime; } public long getEndTime() { return endTime; } public void setEndTime(long endTime) { this.endTime = endTime; } public List getTeamIds() { return teamIds; } public void setTeamIds(List teamIds) { this.teamIds = teamIds; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } }

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

200
成功
League{leagueId=9866, logo="http://qn.feijing88.com/feijing-home/egame/image/20190514/49cd2c63e3834fa2a92df8f1d02ec390.png", name="DreamHack Open Sevilla 2019", country="Spain", location="Sevilla, Spain", startTime=1576234800000, endTime=1576407600000, teamIds=[], status=2}
League{leagueId=9342, logo="http://qn.feijing88.com/feijing-home/egame/image/20190801/a50756930fbe44b68b35c1e63febfe70.jpg", name="Gamers Club Masters IV", country="Brazil", location="Sorocaba, São Paulo", startTime=1576148400000, endTime=1577012400000, teamIds=[], status=0}
League{leagueId=9253, logo="http://qn.feijing88.com/feijing-home/egame/image/20190624/06280d3da7e640708ff86179eee76ffb.jpg", name="ESL Pro League Season 10 Finals", country="Denmark", location="Odense, Denmark", startTime=1575630000000, endTime=1575802800000, teamIds=[], status=2}
League{leagueId=9868, logo="http://qn.feijing88.com/feijing-home/egame/image/20190514/7190e798f3d84ce2b52902f09dbc2349.png", name="DreamHack Open Winter 2019", country="Sweden", location="Jönköping, Sweden", startTime=1575025200000, endTime=1575198000000, teamIds=[], status=0}
League{leagueId=9240, logo="http://qn.feijing88.com/feijing-home/egame/image/20190711/b340bbdf32554914961b4a1e328a3c9b.png", name="CS:GO Asia Championships 2019", country="China", location="Shanghai, China", startTime=1574334000000, endTime=1574593200000, teamIds=[9425, 5761, 9428], status=2}
League{leagueId=9867, logo="http://qn.feijing88.com/feijing-home/egame/image/20190514/04e44a98f9564a4983568ae8b95bc506.png", name="DreamHack Open Atlanta 2019", country="United States", location="Atlanta, Georgia, USA", startTime=1573815600000, endTime=1573988400000, teamIds=[], status=0}
League{leagueId=9246, logo="http://qn.feijing88.com/feijing-home/egame/image/20190713/7a21b891f3fd493c94c19e17d82d543c.jpg", name="eXTREMESLAND 2019 Asia Finals", country="China", location="Shanghai, China", startTime=1573729200000, endTime=1573988400000, teamIds=[], status=2}
League{leagueId=9307, logo="http://qn.feijing88.com/feijing-home/egame/image/20190627/2f20036ba3a84bbb90815f1acb8c2dbf.jpg", name="BLAST Pro Series Copenhagen 2019", country="Denmark", location="Copenhagen, Denmark", startTime=1572606000000, endTime=1572692400000, teamIds=[1538, 2221, 9204, 9966], status=2}
League{leagueId=9348, logo="http://qn.feijing88.com/feijing-home/egame/image/20190801/aad3efd47ed64a1a922ae1b56dbc3996.png", name="ESL LA League Season 5 Finals", country="Brazil", location="São Paulo", startTime=1572084000000, endTime=1572170400000, teamIds=[], status=2}
League{leagueId=9275, logo="http://qn.feijing88.com/feijing-home/egame/image/20190521/5860289be57d46dc88eaa30bac90bb45.png", name="Logitech G Challenge 2019", country="Mexico", location="Mexico City, Mexico", startTime=1571997600000, endTime=1571997600000, teamIds=[], status=2}

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

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

相关文章

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

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

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

    摘要:战队列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容 https://www.xxe.io/import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.annotation.JSONField; import java.nio.charset.StandardCharsets;import...

    Me_Kun 评论0 收藏0
  • 电竞CSGO数据API接口 - 【战队数据列表API调用示例代码

    摘要:战队列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容 https://www.xxe.io/import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.annotation.JSONField; import java.nio.charset.StandardCharsets;import...

    Amio 评论0 收藏0
  • 电竞CSGO数据API接口 - 【最近赛事列表API调用示例代码

    摘要:最近赛事列表获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容 https://www.xxe.io/import com.alibaba.fastjson.JSON;import com.alibaba.fastjson.annotation.JSONField; import java.nio.charset.StandardCharsets;impo...

    Channe 评论0 收藏0
  • 电竞数据API接口 - 【英雄联盟联赛列表API调用示例代码

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

    amc 评论0 收藏0

发表评论

0条评论

BaronZhang

|高级讲师

TA的文章

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