King glory: app interface of E-sports data [player information]

Time:2021-7-26

King glory E-sports API dedicated data interface sharing code

Example demonstration: kingglory [player information] interface
Share and use wild sub datahttp://yes-esports.com/Sample code of data interface call of E-sports API

The details are as follows:
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: score data
@Website: https://www.xxe.io/
@Website: http://www.yesesport.com/
@Website: http://www.yezidianjing.com/
*/
public class CsgoMatch {

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.getMatchList().forEach(System.out::println);

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: player basic information
 * @Website: http://www.yezishuju.com/yxlm/
 */
public class LolPlayer {
 
    public static void main(String[] args) {
        try {
            String content = getContent();
            Respond rsp = JSON.parseObject(content, Respond.class);
            System.out.println(rsp);
 
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
 
    /**
     *Get API return content
     * <p>
     *Note: for the convenience of testing, I used a local file, which should be replaced with the returned content of the real interface
     */
    private static String getContent() {
        try {
            StringBuilder builder = new StringBuilder();
            List<String> lines = Files.readAllLines(Paths.get("./src/main/resources/LolPlayer.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 Player data;
 
        @Override
        public String toString() {
            return "Respond{" +
                    "code=" + code +
                    ", message='" + message + '\'' +
                    ", data=" + data +
                    '}';
        }
 
        public void setCode(int code) {
            this.code = code;
        }
 
        public void setMessage(String message) {
            this.message = message;
        }
 
        public void setData(Player data) {
            this.data = data;
        }
    }
 
    public static class Player {
 
        @JSONField
        private int playerId;
        @JSONField
        private int teamId;
        @JSONField
        private String avatar;
        @JSONField
        private String nickName;
        @JSONField
        private String realName;
        @JSONField
        private String position;
        @JSONField
        private String country;
        @JSONField
        private String introduction;
 
        @Override
        public String toString() {
            return "Player{" +
                    "playerId=" + playerId +
                    ", teamId=" + teamId +
                    ", avatar='" + avatar + '\'' +
                    ", nickName='" + nickName + '\'' +
                    ", realName='" + realName + '\'' +
                    ", position='" + position + '\'' +
                    ", country='" + country + '\'' +
//                    ", introduction='" + introduction + '\'' +
                    '}';
        }
 
        public void setPlayerId(int playerId) {
            this.playerId = playerId;
        }
 
        public void setTeamId(int teamId) {
            this.teamId = teamId;
        }
 
        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }
 
        public void setNickName(String nickName) {
            this.nickName = nickName;
        }
 
        public void setRealName(String realName) {
            this.realName = realName;
        }
 
        public void setPosition(String position) {
            this.position = position;
        }
 
        public void setCountry(String country) {
            this.country = country;
        }
 
        public void setIntroduction(String introduction) {
            this.introduction = introduction;
        }
    }
 
}

The API returns the following data (partial):

Response {code = 200, message = 'success', data = player {playerid = 1, teamid = 6, avatar =' https://imgs.developpaper.com/imgs/2.png , nickname ='clearlove ', realName =' Mingkai ', position =' fighting wild ', country =' China '}}

Recommended Today

VBS obtains the operating system and its version number

VBS obtains the operating system and its version number ? 1 2 3 4 5 6 7 8 9 10 11 12 ‘************************************** ‘*by r05e ‘* operating system and its version number ‘************************************** strComputer = “.” Set objWMIService = GetObject(“winmgmts:” _  & “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2”) Set colOperatingSystems = objWMIService.ExecQuery _  (“Select * from […]