摘要:籃球數據即時賠率調用示例代碼,在線文檔可注冊下,籃球賠率接口詳情頁籃球全場賠率接口為了展示只輸出條數據,實際不止獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分友誼賽泛美男籃菲專員
籃球數據【即時賠率】API調用示例代碼,在線文檔可注冊下,籃球賠率接口詳情頁
import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; /** * @API: 8.1籃球全場賠率接口 * @Website: https://www.feijing88.com */ public class BasketballOdds { public static void main(String[] args) { Odds odds = new Odds(); odds.parse(getContent()); // 為了展示只輸出3條數據,實際不止 odds.getLeagueList().subList(0, 3).forEach(System.out::println); odds.getMatchList().subList(0, 3).forEach(System.out::println); odds.getRangFenList().subList(0, 3).forEach(System.out::println); odds.getOuPeiList().subList(0, 3).forEach(System.out::println); odds.getDaXiaoList().subList(0, 3).forEach(System.out::println); } /** * 獲取API返回內容 * * Note: 這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容 */ private static String getContent() { try { StringBuilder builder = new StringBuilder(); Listlines = Files.readAllLines(Paths.get("./src/main/resources/BasketballBet.xml"), StandardCharsets.UTF_8); lines.forEach(line -> builder.append(line)); return builder.toString(); } catch (Throwable t) { t.printStackTrace(); return ""; } } public static class Odds { private List leagueList; private List matchList; private List rangQiuList; private List shengPingFuList; private List daXiaoList; public void parse(String data) { String[] parts = data.split("$"); leagueList = Arrays.stream(parts[0].split(";")) .map(s -> { League obj = new League(); obj.parse(s); return obj; }) .collect(Collectors.toList()); matchList = Arrays.stream(parts[1].split(";")) .map(s -> { Match obj = new Match(); obj.parse(s); return obj; }) .collect(Collectors.toList()); rangQiuList = Arrays.stream(parts[2].split(";")) .map(s -> { RangFen obj = new RangFen(); obj.parse(s); return obj; }) .collect(Collectors.toList()); shengPingFuList = Arrays.stream(parts[3].split(";")) .map(s -> { OuPei obj = new OuPei(); obj.parse(s); return obj; }) .collect(Collectors.toList()); daXiaoList = Arrays.stream(parts[4].split(";")) .map(s -> { DaXiao obj = new DaXiao(); obj.parse(s); return obj; }) .collect(Collectors.toList()); } public List getLeagueList() { return leagueList; } public List getMatchList() { return matchList; } public List getRangFenList() { return rangQiuList; } public List getOuPeiList() { return shengPingFuList; } public List getDaXiaoList() { return daXiaoList; } } public static class League { private String leagueId; private int type; private String leagueNameGb; public void parse(String data) { String[] values = data.split(","); leagueId = values[0]; type = Integer.valueOf(values[1]); leagueNameGb = values[3]; } @Override public String toString() { return "League{" + "leagueId="" + leagueId + """ + ", type=" + type + ", leagueNameGb="" + leagueNameGb + """ + "}"; } } public static class Match { private String matchId; private String leagueId; private String matchTime; private String homeTeamId; private String homeTeamNameGb; private String homeTeamNameBig; private String homeTeamNameEn; private String homeTeamRank; private String awayTeamId; private String awayTeamNameGb; private String awayTeamNameBig; private String awayTeamNameEn; private String awayTeamRank; private int matchStatus; private String homeTeamScore; private String awayTeamScore; public void parse(String data) { String[] values = data.split(","); matchId = values[0]; leagueId = values[1]; matchTime = values[2]; homeTeamId = values[3]; homeTeamNameGb = values[4]; homeTeamNameBig = values[5]; homeTeamNameEn = values[6]; homeTeamRank = values[7]; awayTeamId = values[8]; awayTeamNameGb = values[9]; awayTeamNameBig = values[10]; awayTeamNameEn = values[11]; awayTeamRank = values[12]; matchStatus = Integer.valueOf(values[13]); homeTeamScore = values[14]; awayTeamScore = values[15]; } @Override public String toString() { return "Match{" + "matchId="" + matchId + """ + ", leagueId="" + leagueId + """ + ", matchTime="" + matchTime + """ + ", homeTeamId="" + homeTeamId + """ + ", homeTeamNameGb="" + homeTeamNameGb + """ + ", homeTeamNameBig="" + homeTeamNameBig + """ + ", homeTeamNameEn="" + homeTeamNameEn + """ + ", homeTeamRank=" + homeTeamRank + ", awayTeamId="" + awayTeamId + """ + ", awayTeamNameGb="" + awayTeamNameGb + """ + ", awayTeamNameBig="" + awayTeamNameBig + """ + ", awayTeamNameEn="" + awayTeamNameEn + """ + ", awayTeamRank=" + awayTeamRank + ", matchStatus=" + matchStatus + ", homeTeamScore=" + homeTeamScore + ", awayTeamScore=" + awayTeamScore + "}"; } } public static class RangFen { private String matchId; private String companyId; private String initHandicap; private String initHomeOdds; private String initAwayOdds; private String handicap; private String homeOdds; private String awayOdds; public void parse(String data) { String[] values = data.split(","); matchId = values[0]; companyId = values[1]; initHandicap = values[2]; initHomeOdds = values[3]; initAwayOdds = values[4]; handicap = values[5]; homeOdds = values[6]; awayOdds = values[7]; } @Override public String toString() { return "RangFen{" + "matchId="" + matchId + """ + ", companyId="" + companyId + """ + ", initHandicap="" + initHandicap + """ + ", initHomeOdds="" + initHomeOdds + """ + ", initAwayOdds="" + initAwayOdds + """ + ", handicap="" + handicap + """ + ", homeOdds="" + homeOdds + """ + ", awayOdds="" + awayOdds + """ + "}"; } } public static class OuPei { private String matchId; private String companyId; private String initHomeOdds; private String initAwayOdds; private String homeOdds; private String awayOdds; public void parse(String data) { String[] values = data.split(","); matchId = values[0]; companyId = values[1]; initHomeOdds = values[2]; initAwayOdds = values[3]; homeOdds = values[4]; awayOdds = values[5]; } @Override public String toString() { return "OuPei{" + "matchId="" + matchId + """ + ", companyId="" + companyId + """ + ", initHomeOdds="" + initHomeOdds + """ + ", initAwayOdds="" + initAwayOdds + """ + ", homeOdds="" + homeOdds + """ + ", awayOdds="" + awayOdds + """ + "}"; } } public static class DaXiao { private String matchId; private String companyId; private String initHandicap; private String initBigOdds; private String initSmallOdds; private String handicap; private String bigOdds; private String smallOdds; public void parse(String data) { String[] values = data.split(","); matchId = values[0]; companyId = values[1]; initHandicap = values[2]; initBigOdds = values[3]; initSmallOdds = values[4]; handicap = values[5]; bigOdds = values[6]; smallOdds = values[7]; } @Override public String toString() { return "DaXiao{" + "matchId="" + matchId + """ + ", companyId="" + companyId + """ + ", initHandicap="" + initHandicap + """ + ", initBigOdds="" + initBigOdds + """ + ", initSmallOdds="" + initSmallOdds + """ + ", handicap="" + handicap + """ + ", bigOdds="" + bigOdds + """ + ", smallOdds="" + smallOdds + """ + "}"; } } }
API 返回數據如下(部分):
League{leagueId="57", type=2, leagueNameGb="友誼賽"} League{leagueId="296", type=2, leagueNameGb="泛美男籃"} League{leagueId="311", type=2, leagueNameGb="菲專員杯"} Match{matchId="359773", leagueId="57", matchTime="1564732800000", homeTeamId="6497", homeTeamNameGb="圖文巴登山者女籃", homeTeamNameBig="圖文巴登山者女籃", homeTeamNameEn="Toowoomba M W", homeTeamRank=, awayTeamId="2883", awayTeamNameGb="布里斯班斯巴達人女籃", awayTeamNameBig="布里斯班斯巴達人女籃", awayTeamNameEn="Brisbane Spartans (W)", awayTeamRank=, matchStatus=2, homeTeamScore=25, awayTeamScore=23} Match{matchId="359771", leagueId="57", matchTime="1564734600000", homeTeamId="5762", homeTeamNameGb="麥凱隕石女籃", homeTeamNameBig="麥凱隕石女籃", homeTeamNameEn="Mackay Meteorettes (W)", homeTeamRank=, awayTeamId="5760", awayTeamNameGb="羅克漢普頓旋風女籃", awayTeamNameBig="羅克漢普頓旋風女籃", awayTeamNameEn="Rockhampton Cyclones (W)", awayTeamRank=, matchStatus=0, homeTeamScore=, awayTeamScore=} Match{matchId="359772", leagueId="57", matchTime="1564740000000", homeTeamId="5812", homeTeamNameGb="圖文巴登山者", homeTeamNameBig="圖文巴登山者", homeTeamNameEn="Toowoomba Mountaineers", homeTeamRank=, awayTeamId="2358", awayTeamNameGb="布里斯班斯巴達人", awayTeamNameBig="布里斯班斯巴達人", awayTeamNameEn="Brisbane Spartans", awayTeamRank=東南澳聯4, matchStatus=0, homeTeamScore=, awayTeamScore=} RangFen{matchId="358894", companyId="2", initHandicap="17.5", initHomeOdds="0.83", initAwayOdds="0.87", handicap="17.5", homeOdds="0.87", awayOdds="0.83"} RangFen{matchId="358894", companyId="3", initHandicap="17.5", initHomeOdds="0.90", initAwayOdds="0.90", handicap="17.5", homeOdds="0.90", awayOdds="0.90"} RangFen{matchId="358894", companyId="8", initHandicap="11.5", initHomeOdds="0.83", initAwayOdds="0.83", handicap="17.5", homeOdds="0.83", awayOdds="0.83"} OuPei{matchId="358894", companyId="2", initHomeOdds="1.04", initAwayOdds="8.40", homeOdds="1.04", awayOdds="8.40"} OuPei{matchId="358894", companyId="9", initHomeOdds="1.154", initAwayOdds="4.80", homeOdds="1.056", awayOdds="8.00"} OuPei{matchId="358894", companyId="8", initHomeOdds="1.14", initAwayOdds="5.00", homeOdds="1.03", awayOdds="9.50"} DaXiao{matchId="358894", companyId="5", initHandicap="143.5", initBigOdds="0.87", initSmallOdds="0.83", handicap="141.5", bigOdds="0.79", smallOdds="0.91"} DaXiao{matchId="358894", companyId="6", initHandicap="141.5", initBigOdds="0.88", initSmallOdds="0.88", handicap="142.5", bigOdds="0.70", smallOdds="1.06"} DaXiao{matchId="358894", companyId="11", initHandicap="143.5", initBigOdds="0.83", initSmallOdds="0.83", handicap="141.5", bigOdds="0.83", smallOdds="0.83"}
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/106434.html
摘要:籃球數據即時賠率調用示例代碼,在線文檔可注冊下,籃球賠率接口詳情頁籃球全場賠率接口為了展示只輸出條數據,實際不止獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分友誼賽泛美男籃菲專員 籃球數據【即時賠率】API調用示例代碼,在線文檔可注冊下,籃球賠率接口詳情頁 import java.nio.charset.StandardCharsets...
摘要:分享籃球即時比分接口調用的示例代碼,可查看在線調用文檔,需注冊下即時變化的比分數據獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分 分享籃球即時比分api接口調用的示例代碼,可查看在線調用文檔,需注冊下https://www.feijing88.com/bas... package com.huaying.demo.basketball;...
摘要:分享籃球即時比分接口調用的示例代碼,可查看在線調用文檔,需注冊下即時變化的比分數據獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分 分享籃球即時比分api接口調用的示例代碼,可查看在線調用文檔,需注冊下https://www.feijing88.com/bas... package com.huaying.demo.basketball;...
摘要:分享籃球即時比分接口調用的示例代碼,可查看在線調用文檔,需注冊下即時變化的比分數據獲取返回內容這里為了方便測試我使用了一份本地文件,使用時應替換為真實接口返回內容返回數據如下部分 分享籃球即時比分api接口調用的示例代碼,可查看在線調用文檔,需注冊下https://www.feijing88.com/bas... package com.huaying.demo.basketball;...
閱讀 3118·2021-11-15 18:14
閱讀 1773·2021-09-22 10:51
閱讀 3283·2021-09-09 09:34
閱讀 3505·2021-09-06 15:02
閱讀 1013·2021-09-01 11:40
閱讀 3186·2019-08-30 13:58
閱讀 2523·2019-08-30 11:04
閱讀 1081·2019-08-28 18:31