From 071ab1ad2366b311748779a1eba733c0124f1296 Mon Sep 17 00:00:00 2001 From: Vedant-200 Date: Wed, 18 Nov 2026 12:30:12 +0530 Subject: [PATCH] fix: address issue #1 --- src/services/bilibili.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/services/bilibili.ts b/src/services/bilibili.ts index fb2e22f..48c0c43 100644 --- a/src/services/bilibili.ts +++ b/src/services/bilibili.ts @@ -72,6 +72,24 @@ export class BilibiliService { return data; } + /** + * 获取视频热度序列(播放进度条热度数据) + * 该序列可作为 LSTM/Transformer 时间序列模型的输入,用于识别广告片段 + * @param bvid 视频的BVID + * @param cid 视频的CID + * @returns 各时间片的热度数值数组 + */ + public static async getVideoHeat(bvid: string, cid: number) { + console.log('【VideoAdGuard】[BilibiliService] Getting video heat'); + const data = await this.fetchWithCookie( + 'https://api.bilibili.com/x/player/pbp', + { bvid: bvid, cid: cid } + ); + const heat = Array.isArray(data) ? data : data?.pbp; + console.log('【VideoAdGuard】[BilibiliService] Video heat result:', heat); + return Array.isArray(heat) ? heat : []; + } + public static async getCaptions(url: string) { console.log('【VideoAdGuard】[BilibiliService] Getting captions from URL:', url); const response = await fetch(url);