MCPcopy Create free account
hub / github.com/OreosLab/bili / getVideoTitle

Method getVideoTitle

src/main/java/top/misec/api/OftenApi.java:60–75  ·  view source on GitHub ↗

请求视频title,未获取到时返回bvid. @return title

(String bvid)

Source from the content-addressed store, hash-verified

58 * @return title
59 */
60 public static String getVideoTitle(String bvid) {
61 String title;
62 String urlParameter = "?bvid=" + bvid;
63 JsonObject jsonObject = HttpUtils.doGet(ApiList.VIDEO_VIEW + urlParameter);
64
65 if (jsonObject.get("code").getAsInt() == 0) {
66 title = jsonObject.getAsJsonObject("data").getAsJsonObject("owner").get("name").getAsString() + ": ";
67 title += jsonObject.getAsJsonObject("data").get("title").getAsString();
68 } else {
69 title = "未能获取标题";
70 log.info(title);
71 log.debug(jsonObject.get("message").getAsString());
72 }
73
74 return title.replace("&", "-");
75 }
76
77 /**
78 * query username.

Callers 3

watchVideoMethod · 0.95
dailyAvShareMethod · 0.95
coinAddMethod · 0.95

Calls 1

doGetMethod · 0.95

Tested by

no test coverage detected