(String bvid)
| 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. |
no test coverage detected