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

Method watchVideo

src/main/java/top/misec/task/VideoWatch.java:49–61  ·  view source on GitHub ↗
(String bvid)

Source from the content-addressed store, hash-verified

47 }
48
49 public void watchVideo(String bvid) {
50 int playedTime = new Random().nextInt(90) + 1;
51 String postBody = "bvid=" + bvid
52 + "&played_time=" + playedTime;
53 JsonObject resultJson = HttpUtils.doPost(ApiList.VIDEO_HEARTBEAT, postBody);
54 String videoTitle = OftenApi.getVideoTitle(bvid);
55 int responseCode = resultJson.get(STATUS_CODE_STR).getAsInt();
56 if (responseCode == 0) {
57 log.info("视频: {}播放成功,已观看到第{}秒", videoTitle, playedTime);
58 } else {
59 log.warn("视频: {}播放失败,原因: {}", videoTitle, resultJson.get("message").getAsString());
60 }
61 }
62
63 /**
64 * @param bvid 要分享的视频bvid.

Callers 2

runMethod · 0.95
coinAddMethod · 0.80

Calls 2

doPostMethod · 0.95
getVideoTitleMethod · 0.95

Tested by

no test coverage detected