Skip to content

Commit e16339a

Browse files
authored
Feature videodownload 20250422 (#71)
* ✨ 添加视频下载地址 * ✨ 添加结构体
1 parent 4856397 commit e16339a

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

bilibili/types.go

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ const (
4747
AllGuardURL = "https://api.vtbs.moe/v1/guard/all"
4848
// VideoSummaryURL AI视频总结
4949
VideoSummaryURL = "https://api.bilibili.com/x/web-interface/view/conclusion/get?bvid=%v&cid=%v&up_mid=%v"
50+
// VideoDownloadURL 视频下载
51+
VideoDownloadURL = "https://api.bilibili.com/x/player/playurl?bvid=%v&cid=%v&qn=80&fnval=1&fnver=0&fourk=1"
52+
// OnlineTotalURL 在线人数
53+
OnlineTotalURL = "https://api.bilibili.com/x/player/online/total?bvid=%v&cid=%v"
5054
// NavURL 导航URL
5155
NavURL = "https://api.bilibili.com/x/web-interface/nav"
5256
// ConstUA 浏览器UA
@@ -403,6 +407,65 @@ type VideoSummary struct {
403407
} `json:"data"`
404408
}
405409

410+
// VideoDownload 视频下载结构体(mp4格式)
411+
type VideoDownload struct {
412+
Code int `json:"code"`
413+
Message string `json:"message"`
414+
TTL int `json:"ttl"`
415+
Data struct {
416+
From string `json:"from"`
417+
Result string `json:"result"`
418+
Message string `json:"message"`
419+
Quality int `json:"quality"`
420+
Format string `json:"format"`
421+
Timelength int `json:"timelength"`
422+
AcceptFormat string `json:"accept_format"`
423+
AcceptDescription []string `json:"accept_description"`
424+
AcceptQuality []int `json:"accept_quality"`
425+
VideoCodecid int `json:"video_codecid"`
426+
SeekParam string `json:"seek_param"`
427+
SeekType string `json:"seek_type"`
428+
Durl []struct {
429+
Order int `json:"order"`
430+
Length int `json:"length"`
431+
Size int `json:"size"`
432+
Ahead string `json:"ahead"`
433+
Vhead string `json:"vhead"`
434+
URL string `json:"url"`
435+
BackupURL []string `json:"backup_url"`
436+
} `json:"durl"`
437+
SupportFormats []struct {
438+
Quality int `json:"quality"`
439+
Format string `json:"format"`
440+
NewDescription string `json:"new_description"`
441+
DisplayDesc string `json:"display_desc"`
442+
Superscript string `json:"superscript"`
443+
Codecs interface{} `json:"codecs"`
444+
} `json:"support_formats"`
445+
HighFormat interface{} `json:"high_format"`
446+
LastPlayTime int `json:"last_play_time"`
447+
LastPlayCid int `json:"last_play_cid"`
448+
} `json:"data"`
449+
}
450+
451+
// OnlineTotal 在线人数结构体
452+
type OnlineTotal struct {
453+
Code int `json:"code"`
454+
Message string `json:"message"`
455+
TTL int `json:"ttl"`
456+
Data struct {
457+
Total string `json:"total"`
458+
Count string `json:"count"`
459+
ShowSwitch struct {
460+
Total bool `json:"total"`
461+
Count bool `json:"count"`
462+
} `json:"show_switch"`
463+
Abtest struct {
464+
Group string `json:"group"`
465+
} `json:"abtest"`
466+
} `json:"data"`
467+
}
468+
406469
// CookieConfig 配置结构体
407470
type CookieConfig struct {
408471
BilibiliCookie string `json:"bilibili_cookie"`

0 commit comments

Comments
 (0)