篮球比赛动画直播变化数据API调用示例,详细请查看在线文档,需注册下

package com.huaying.demo.basketball;

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;

import java.util.stream.Collectors;

/**

* 22.篮球比赛动画直播变化数据

*

* @Website: https://www.feijing88.com

*/

public class BasketballAnimationLiveChange {

public static void main(String[] args) {

try {

String content = getContent();

JAXBContext jaxbContext = JAXBContext.newInstance(ResultList.class);

Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

ResultList list = (ResultList) unmarshaller.unmarshal(new ByteArrayInputStream(content.getBytes()));

list.getResultList().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/BasketballAnimationLive.xml"), StandardCharsets.UTF_8);

lines.forEach(line -> builder.append(line));

return builder.toString();

} catch (Throwable t) {

t.printStackTrace();

return "";

}

}

@XmlRootElement(name = "c")

public static class ResultList {

@XmlElement(name = "match")

private List itemList;

public List getResultList() {

return itemList.stream()

.map(AnimationLive::parse)

.collect(Collectors.toList());

}

}

private static class AnimationLive {

@XmlElement(name = "f")

private String data;

private String matchInfo;

private String animationLive;

public AnimationLive parse() {

String[] values = data.split("!");

matchInfo = getData(values, 0);

animationLive = getData(values, 1);

return this;

}

private String getData(String[] values, int index) {

if (index >= 0 && index < values.length) {

return values[index];

} else {

return null;

}

}

@Override

public String toString() {

return "AnimationLive{" +

"matchInfo='" + matchInfo + '\'' +

", animationLive='" + animationLive + '\'' +

'}';

}

}

}

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

AnimationLive{matchInfo='365898^1679^84^/files/team/20190124183405.jpg^/files/team/20190124185630.jpg^4', animationLive='3430861,0,12,-1,,0'}

AnimationLive{matchInfo='365903^1576^1577^/files/team/20190124182112.jpg^/files/team/20190124181344.jpg^4', animationLive='3430982,0,12,-1,,0'}

AnimationLive{matchInfo='365921^83^723^/files/team/20190124175730.jpg^/files/team/20190124184900.jpg^-1', animationLive='3430956,0,12,-1,,0'}

AnimationLive{matchInfo='365902^732^2079^/files/team/20190124182503.jpg^/files/team/20190124184216.jpg^-1', animationLive='3431088,0,12,-1,,0'}

AnimationLive{matchInfo='353406^73^76^/files/team/73.gif^/files/team/20180508172444.png^-1', animationLive='3433286,0,12,-1,,0'}

AnimationLive{matchInfo='353407^69^707^/files/team/20181110020130.jpg^/files/team/707.jpg^4', animationLive='3433268,0,12,-1,,0'}

AnimationLive{matchInfo='353408^66^75^/files/team/20160426141738.jpg^/files/team/75.gif^4', animationLive='3433215,0,12,-1,,0'}

AnimationLive{matchInfo='353409^67^65^/files/team/67.gif^/files/team/20181110022755.jpg^4', animationLive='3433214,0,12,-1,,0'}

AnimationLive{matchInfo='353410^2013^68^/files/team/2013.gif^/files/team/68.gif^4', animationLive='3433091,0,12,-1,,0'}

AnimationLive{matchInfo='353411^71^72^/files/team/71.gif^/files/team/20181110022628.jpg^-1', animationLive='3433226,0,12,-1,,0'}

AnimationLive{matchInfo='365916^2434^85^/files/team/20190124190057.jpg^/files/team/20190124183337.jpg^0', animationLive='null'}

php篮球比赛,篮球数据API接口 - 【篮球比赛动画直播变化数据】API调用示例代码...相关推荐

  1. php篮球比赛,篮球数据API接口-【篮球比赛动画直播变化数据】API调用示例代码...

    篮球比赛动画直播变化数据API调用示例,详细请查看在线文档,需注册下 package com.huaying.demo.basketball; import javax.xml.bind.JAXBCo ...

  2. python动画定义篮球大小_篮球数据API接口 - 【篮球比赛动画直播变化数据】API调用示例代码...

    篮球比赛动画直播变化数据API调用示例,详细请查看在线文档,需注册下 package com.huaying.demo.basketball; import javax.xml.bind.JAXBCo ...

  3. 足球数据API接口 - 【比赛动画直播变化数据】API调用示例代码

    分享示例代码,足球数据[比赛动画直播变化数据]接口 package com.huaying.demo.football;import javax.xml.bind.JAXBContext; impor ...

  4. 电竞英雄联盟数据API接口 - 【比赛列表】API调用示例代码

    电竞英雄联盟数据API接口 - [比赛列表]API调用示例代码 分享使用 野子科技数据 https://www.xxe.io/ 接口调用的示例代码,今天接的是英雄联盟的[比赛列表]接口,跟之前不同的是 ...

  5. php api json,PHP API接口必备之输出json格式数据实例详解

    这篇文章主要给大家介绍了关于PHP API接口必备之输出json格式数据的相关资料文中通过示例代码介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧. 前言 我们在日常的开发工 ...

  6. 拼多多商品详情页 API接口、拼多多商品SKU数据接口 API接口、拼多多关键词搜索接口 API接口 API接口、拼多多关键词采集 API接口、拼多多采集接口 API接口、拼多多详情 API接口

    拼多多API接口,提供商品解析,商品采集等. 拼多多采购项目.店群项目等都可以对接 下方点击注册就可以对接了 点击注册 拼多多商品详情页 API接口.拼多多商品SKU数据接口 API接口.拼多多关键词 ...

  7. 1688搜索新品API接口-(按关键字搜索新品数据API接口)

    一.1688搜索新品API接口-(按关键字搜索新品数据API接口)代码如下: 1.公共参数: 名称 类型 必须 描述 key String 是 调用key(必须以GET方式拼接在URL中) secre ...

  8. 1688搜索工厂数据API接口-(item_search_factory-按关键字搜索工厂数据API接口)

    一.1688搜索工厂数据API接口-(item_search_factory-按关键字搜索工厂数据API接口)代码对接如下: 1.公共参数 名称 类型 必须 描述 key String 是 调用key ...

  9. 唯品会关键字搜索商品API接口(item_search-按关键字搜索唯品会商品API接口),唯品会API接口

    一.唯品会关键字搜索商品API接口(item_search-按关键字搜索唯品会商品API接口),唯品会API接口接口可获取到宝贝标题,宝贝价格,宝贝ID,宝贝图片,优惠价,宝贝链接,卖家昵称,店铺所在 ...

最新文章

  1. 如何每天自动备份 SourceSafe (转)
  2. 单片机涡轮流量传感器_暖通慧教你一文读懂流量传感器
  3. cvs有机添加剂检测_汽车到底有没有必要添加燃油添加剂,如果需要加从什么时间开始用...
  4. 量子计算入门-第一部分
  5. arch linux键盘布局,Arch Linux的安装、配置、优化及美化(一)
  6. Pytorch(七) --加载数据集
  7. 转:Node.js和testacular的安装与配置
  8. Springboot 自定义Tomcat默认Servlet 资源路径
  9. C++ 公有继承、保护继承和私有继承中类成员的访问权限的控制
  10. LeetCode10. 正则表达式匹配
  11. 利用 50 行 Python 代码构建一个在线文本生成器!
  12. 谷歌不修用户泪流:已遭利用且影响所有安卓版本的严重 0day 漏洞 StrandHogg 详情遭曝光...
  13. javascript数据结构之队列
  14. 一个敲有趣的R语言拼图工具
  15. 十六进制转十进制_跟运维组学Python之秒懂十六进制
  16. 深信服php面经,深信服面经
  17. Nginx(1)基础部分
  18. Qt开发之QLineEdit简单介绍
  19. 拦截电话--- 关于利用反射 调用系统 hiden的 方法
  20. 阿里云天池大赛赛题(深度学习)——人工智能辅助构建知识图谱(完整代码)

热门文章

  1. 4.3 计算机网络之IPv4(IPv4分组、IPv4地址、NAT、子网划分与子网掩码、CIDR、ARP协议、DHCP、ICMP)
  2. java 钉钉获取用户信息,JAVA maven项目如何使用钉钉SDK来获取token、用户
  3. python的django后台管理_python测试开发django-17.admin后台管理
  4. Android studio百度地图的使用
  5. Ubuntu下安装依赖包问题总结
  6. java空指针处理例子_被同事的空指针硬生生的折磨了好久,终于学会了如何处理空指针...
  7. java怎么用return代替else_java – 从一个隐含或明确的“else”方法返回,还是用一个“return”语句返回?...
  8. git 配置origin_git配置及操作
  9. 两线怎么接三线插座图_一文搞懂电工配电二线制、三线制、四线制
  10. future 线程报错后_线程池运用实例——一次错误的多线程程序设计以及修复过程...