优化
This commit is contained in:
@@ -22,6 +22,7 @@ public class LiveInfoController {
|
||||
|
||||
@GetMapping("/live/{cnlid}")
|
||||
public String getLiveInfo(@PathVariable String cnlid) throws Exception {
|
||||
log.info("执行查询直播cnlid: {}", cnlid);
|
||||
return liveInfoService.getLiveInfo(cnlid);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class LiveInfoService {
|
||||
|
||||
// 2. 打印请求头(Cookie)
|
||||
String cookie = getCookieForRequest();
|
||||
log.info("请求头 Cookie: {}", cookie);
|
||||
// log.info("请求头 Cookie: {}", cookie);
|
||||
|
||||
// 3. 发起请求
|
||||
String res = webClient.get()
|
||||
@@ -128,7 +128,6 @@ public class LiveInfoService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.info("提取到的播放URL数量: {}", urls.size());
|
||||
return urls;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ public class TxSportTokenRefreshService {
|
||||
log.error("Redis 中未找到 Cookie,无法刷新");
|
||||
return false;
|
||||
}
|
||||
log.info("旧的cookie:{}",cookieJson);
|
||||
|
||||
Map<String, String> baseCookies = objectMapper.readValue(cookieJson, new TypeReference<>() {});
|
||||
String cookieHeader = buildCookieHeader(baseCookies);
|
||||
@@ -57,7 +58,6 @@ public class TxSportTokenRefreshService {
|
||||
Long.parseLong(data.path("tokenTTL").asText()),
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
log.error("刷新 Cookie 失败", e);
|
||||
@@ -82,7 +82,7 @@ public class TxSportTokenRefreshService {
|
||||
}
|
||||
|
||||
// 可选:定时自动刷新(你可以打开)
|
||||
@Scheduled(fixedRate = 3600000)
|
||||
@Scheduled(fixedRate = 5400000) // 每90分钟执行一次
|
||||
public void scheduledRefresh() {
|
||||
log.info("定时刷新Cookie");
|
||||
if (!refreshCookies()) {
|
||||
|
||||
Reference in New Issue
Block a user