|
@@ -16,19 +16,21 @@ public class VideoUtils {
|
|
|
|
|
|
|
|
|
public static JSONObject getVideoDetail(Long videoId) {
|
|
|
- JSONObject params = new JSONObject();
|
|
|
- Map<String, Object> data = new HashMap<>();
|
|
|
- data.put("videoIdList", new String[]{String.valueOf(videoId)});
|
|
|
- HttpResponse response = HttpRequest.post(VIDEO_DETAIL_URL)
|
|
|
- .header("Content-Type", "application/json")
|
|
|
- .body(JSONUtil.toJsonStr(data)) // 将数据转换为 JSON 字符串
|
|
|
- .execute();
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(response.body());
|
|
|
- if (jsonObject.getJSONArray("data") != null) {
|
|
|
- return jsonObject.getJSONArray("data").getJSONObject(0);
|
|
|
- } else {
|
|
|
- return null;
|
|
|
+ try {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("videoIdList", new String[]{String.valueOf(videoId)});
|
|
|
+ HttpResponse response = HttpRequest.post(VIDEO_DETAIL_URL)
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .body(JSONUtil.toJsonStr(data)) // 将数据转换为 JSON 字符串
|
|
|
+ .execute();
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(response.body());
|
|
|
+ if (jsonObject.getJSONArray("data") != null) {
|
|
|
+ return jsonObject.getJSONArray("data").getJSONObject(0);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("VideoUtils getVideoDetail error", e);
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|