From e40b9c5749a92351e3456f83ee36ed164f65a9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=94=85=E9=A5=AD?= <1156544355@qq.com> Date: Tue, 22 Apr 2025 23:37:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bilibili/types.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bilibili/types.go b/bilibili/types.go index f135dd4..cea0c7b 100644 --- a/bilibili/types.go +++ b/bilibili/types.go @@ -47,6 +47,8 @@ const ( AllGuardURL = "https://api.vtbs.moe/v1/guard/all" // VideoSummaryURL AI视频总结 VideoSummaryURL = "https://api.bilibili.com/x/web-interface/view/conclusion/get?bvid=%v&cid=%v&up_mid=%v" + // PlayURL 获得视频下载地址 + PlayURL = "https://api.bilibili.com/x/player/playurl?bvid=%v&cid=%v&qn=0&fnval=80&fnver=0&fourk=1" // NavURL 导航URL NavURL = "https://api.bilibili.com/x/web-interface/nav" // ConstUA 浏览器UA From eb4b09c8f654a62aeea72a1bed50df9a95a082e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=94=85=E9=A5=AD?= <1156544355@qq.com> Date: Wed, 23 Apr 2025 16:22:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bilibili/types.go | 65 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/bilibili/types.go b/bilibili/types.go index cea0c7b..ce561ae 100644 --- a/bilibili/types.go +++ b/bilibili/types.go @@ -47,8 +47,10 @@ const ( AllGuardURL = "https://api.vtbs.moe/v1/guard/all" // VideoSummaryURL AI视频总结 VideoSummaryURL = "https://api.bilibili.com/x/web-interface/view/conclusion/get?bvid=%v&cid=%v&up_mid=%v" - // PlayURL 获得视频下载地址 - PlayURL = "https://api.bilibili.com/x/player/playurl?bvid=%v&cid=%v&qn=0&fnval=80&fnver=0&fourk=1" + // VideoDownloadURL 视频下载 + VideoDownloadURL = "https://api.bilibili.com/x/player/playurl?bvid=%v&cid=%v&qn=80&fnval=1&fnver=0&fourk=1" + // OnlineTotalURL 在线人数 + OnlineTotalURL = "https://api.bilibili.com/x/player/online/total?bvid=%v&cid=%v" // NavURL 导航URL NavURL = "https://api.bilibili.com/x/web-interface/nav" // ConstUA 浏览器UA @@ -405,6 +407,65 @@ type VideoSummary struct { } `json:"data"` } +// VideoDownload 视频下载结构体(mp4格式) +type VideoDownload struct { + Code int `json:"code"` + Message string `json:"message"` + TTL int `json:"ttl"` + Data struct { + From string `json:"from"` + Result string `json:"result"` + Message string `json:"message"` + Quality int `json:"quality"` + Format string `json:"format"` + Timelength int `json:"timelength"` + AcceptFormat string `json:"accept_format"` + AcceptDescription []string `json:"accept_description"` + AcceptQuality []int `json:"accept_quality"` + VideoCodecid int `json:"video_codecid"` + SeekParam string `json:"seek_param"` + SeekType string `json:"seek_type"` + Durl []struct { + Order int `json:"order"` + Length int `json:"length"` + Size int `json:"size"` + Ahead string `json:"ahead"` + Vhead string `json:"vhead"` + URL string `json:"url"` + BackupURL []string `json:"backup_url"` + } `json:"durl"` + SupportFormats []struct { + Quality int `json:"quality"` + Format string `json:"format"` + NewDescription string `json:"new_description"` + DisplayDesc string `json:"display_desc"` + Superscript string `json:"superscript"` + Codecs interface{} `json:"codecs"` + } `json:"support_formats"` + HighFormat interface{} `json:"high_format"` + LastPlayTime int `json:"last_play_time"` + LastPlayCid int `json:"last_play_cid"` + } `json:"data"` +} + +// OnlineTotal 在线人数结构体 +type OnlineTotal struct { + Code int `json:"code"` + Message string `json:"message"` + TTL int `json:"ttl"` + Data struct { + Total string `json:"total"` + Count string `json:"count"` + ShowSwitch struct { + Total bool `json:"total"` + Count bool `json:"count"` + } `json:"show_switch"` + Abtest struct { + Group string `json:"group"` + } `json:"abtest"` + } `json:"data"` +} + // CookieConfig 配置结构体 type CookieConfig struct { BilibiliCookie string `json:"bilibili_cookie"`