摘要:分享之前调用过的飞鲸体育数据,可注册使用下篮球联赛数据联赛赛事资料获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分美国男子职业篮球联赛美國男子職業籃球聯賽美国美国女子职业篮球联赛美國女子職業
分享之前调用过的飞鲸体育数据api,可注册使用下篮球联赛数据
</>复制代码
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
/**
* @API: 4.联赛、赛事资料
* @Website: https://www.feijing88.com
*/
public class BasketballLeagueInfo {
public static void main(String[] args) {
try {
String content = getContent();
JAXBContext jaxbContext = JAXBContext.newInstance(LeagueList.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
LeagueList list = (LeagueList) unmarshaller.unmarshal(new ByteArrayInputStream(content.getBytes()));
list.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/BasketballLeagueInfo.xml"), StandardCharsets.UTF_8);
lines.forEach(builder::append);
return builder.toString();
} catch (Throwable t) {
t.printStackTrace();
return "";
}
}
@XmlRootElement(name = "list")
public static class LeagueList {
@XmlElement(name = "match")
private List leagueList;
public List getLeagueList() {
return leagueList;
}
}
public static class League {
@XmlElement(name = "id")
private String id;
@XmlElement(name = "short")
private String nameShort;
@XmlElement(name = "gb")
private String nameGb;
@XmlElement(name = "big")
private String nameBig;
@XmlElement(name = "en")
private String nameEn;
@XmlElement(name = "type")
private int type;
@XmlElement(name = "Curr_matchSeason")
private String currentSeason;
@XmlElement(name = "countryID")
private String countryId;
@XmlElement(name = "country")
private String countryName;
@XmlElement(name = "curr_year")
private int currentYear;
@XmlElement(name = "curr_month")
private int currentMonth;
@XmlElement(name = "sclass_kind")
private int kind;
@Override
public String toString() {
return "League{" +
"id="" + id + """ +
", nameShort="" + nameShort + """ +
", nameGb="" + nameGb + """ +
", nameBig="" + nameBig + """ +
", nameEn="" + nameEn + """ +
", type=" + type +
", currentSeason="" + currentSeason + """ +
", countryId="" + countryId + """ +
", countryName="" + countryName + """ +
", currentYear=" + currentYear +
", currentMonth=" + currentMonth +
", kind=" + kind +
"}";
}
}
}
API 返回数据如下(部分):
</>复制代码
League{id="1", nameShort="NBA", nameGb="美国男子职业篮球联赛", nameBig="美國男子職業籃球聯賽", nameEn="National Basketball Association", type=4, currentSeason="18-19", countryId="1", countryName="美国", currentYear=2011, currentMonth=11, kind=1}
League{id="2", nameShort="WNBA", nameGb="美国女子职业篮球联赛", nameBig="美國女子職業籃球聯賽", nameEn="Women’s National Basketball Association", type=4, currentSeason="19", countryId="1", countryName="美国", currentYear=2011, currentMonth=9, kind=1}
League{id="3", nameShort="斯坦杯", nameGb="斯坦科维奇洲际冠军杯", nameBig="斯坦科域治洲際冠軍盃", nameEn="Stank Vic Basketball Champions LeagueChampions Cup", type=4, currentSeason="18", countryId="20", countryName="国际赛事", currentYear=2011, currentMonth=8, kind=2}
League{id="5", nameShort="CBA", nameGb="中国男子篮球联赛", nameBig="中國男子籃球聯賽", nameEn="Chinese Basketball Association", type=4, currentSeason="18-19", countryId="2", countryName="中国", currentYear=2011, currentMonth=11, kind=1}
League{id="7", nameShort="Euro", nameGb="欧洲篮球冠军联赛", nameBig="歐洲籃球冠軍聯賽", nameEn="EURO", type=4, currentSeason="19-20", countryId="16", countryName="欧洲赛事", currentYear=2011, currentMonth=10, kind=2}
League{id="8", nameShort="NCAA", nameGb="美国大学男子篮球联赛", nameBig="美國大學男子籃球聯賽", nameEn="National Committee Association America", type=2, currentSeason="18-19", countryId="1", countryName="美国", currentYear=2009, currentMonth=11, kind=1}
League{id="9", nameShort="女南锦U17", nameGb="南美洲女子篮球锦标赛U17", nameBig="女南錦U17", nameEn="FIBA Sudamericano Femenino U17", type=4, currentSeason="17", countryId="18", countryName="美洲赛事", currentYear=2011, currentMonth=6, kind=2}
League{id="10", nameShort="篮世杯", nameGb="篮球世界杯", nameBig="籃球世界盃", nameEn="FIBA Basketball World Cup", type=4, currentSeason="19", countryId="20", countryName="国际赛事", currentYear=2010, currentMonth=8, kind=2}
League{id="13", nameShort="世女俱", nameGb="世女俱", nameBig="世女俱", nameEn="The world women Club", type=4, currentSeason="17", countryId="20", countryName="国际赛事", currentYear=2007, currentMonth=10, kind=2}
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/106326.html
摘要:分享之前调用过的飞鲸体育数据,可注册使用下篮球联赛数据联赛赛事资料获取返回内容这里为了方便测试我使用了一份本地文件,使用时应替换为真实接口返回内容返回数据如下部分美国男子职业篮球联赛美國男子職業籃球聯賽美国美国女子职业篮球联赛美國女子職業 分享之前调用过的飞鲸体育数据api,可注册使用下篮球联赛数据 import javax.xml.bind.JAXBContext; import j...
摘要:在本文中,我们将以的决策树和随机森林预测获胜者。用决策树和随机森林预测获胜者导入数据集并解析日期导入熊猫作为。这将帮助我们查看决策树分类器的预测是否正确。混淆矩阵显示了我们决策树的正确和不正确的分类。 showImg(https://segmentfault.com/img/bVbcr26?w=750&h=383); 在本文中,我们将以Scikit-learn的决策树和随机森林预测NB...
摘要:本文意在创建一个得分图,该图同时描绘了从场上不同位置投篮得分的百分比和投篮次数,这和个人网站上的帖子类似。接下来,我们需要绘制一个包含得分图的篮球场图。球员照片会出现在得分图的右下角。的解决办法是将命中率与联赛平均分关联。 本文意在创建一个得分图,该图同时描绘了从场上不同位置投篮得分的百分比和投篮次数,这和 Austin Clemen 个人网站上的帖子 http://www.austi...
摘要:世界杯小组赛将收官,你还依然信吗冷门频出,黑马击败豪强。以本届世界杯开幕战俄罗斯对阵沙特阿拉伯的比赛为例,两队上次交手是在年的一场友谊赛,距今已经年。然后进入第二步,预测回报率导向。在足球领域,这个回报率已非常不俗。 世界杯小组赛将收官,你还依然信AI吗?冷门频出,黑马击败豪强。不少AI模型始料未及。到底还能不能愉快找到科学规律?或者说足球比赛乃至其他竞技体育赛事,数据科学家在AI加持下,究...
阅读 2536·2021-11-16 11:44
阅读 791·2019-08-30 15:55
阅读 3413·2019-08-30 15:52
阅读 3763·2019-08-30 15:43
阅读 2350·2019-08-30 11:21
阅读 585·2019-08-29 12:18
阅读 2103·2019-08-26 18:15
阅读 612·2019-08-26 10:32