https://api.polyv.net/live/v3/channel/statistics/geo-summary-mc
1、接口用于获取多个频道下(聚合查询结果)的地域分布信息
2、接口支持https
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"province": "广东",
"city": "广州",
"viewer": 1,
"percent": 100.0
}
]
}
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
{
"code": 403,
"status": "error",
"message": "illegal channel id: 1234567",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "param is not digit: dsadasd",
"data": ""
}
{
"code": 400,
"status": "error",
"message": "startDate can not great endDater",
"data": ""
}
public static void main(String[] args) {
String url = "http://api.polyv.net/live/v3/channel/statistics/geo-summary-mc;
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
int channelId = 1234567;
String startDate = "2020-08-01";
String endDate = "2020-08-18";
params.put("channelIds", String.valueOf(channelId));
params.put("startDate", startDate);
params.put("endDate", endDate);
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}