Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加了对B站8K超高清视频的支持 #978

Merged
merged 16 commits into from
Dec 7, 2021
8 changes: 4 additions & 4 deletions extractors/bilibili/bilibili.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func genAPI(aid, cid, quality int, bvid string, bangumi bool, cookie string) (st
baseAPIURL = bilibiliBangumiAPI
} else {
params = fmt.Sprintf(
"avid=%d&cid=%d&bvid=%s&qn=%d&type=&otype=json&fourk=1&fnver=0&fnval=16",
"avid=%d&cid=%d&bvid=%s&qn=%d&type=&otype=json&fourk=1&fnver=0&fnval=2000",
aid, cid, bvid, quality,
)
baseAPIURL = bilibiliAPI
Expand Down Expand Up @@ -272,9 +272,9 @@ func bilibiliDownload(options bilibiliOptions, extractOption types.Options) *typ
}

// Get "accept_quality" and "accept_description"
// "accept_description":["高清 1080P","高清 720P","清晰 480P","流畅 360P"],
// "accept_quality":[120,112,80,48,32,16],
api, err := genAPI(options.aid, options.cid, 120, options.bvid, options.bangumi, extractOption.Cookie)
// "accept_description":["超高清 8K","超清 4K","高清 1080P+","高清 1080P","高清 720P","清晰 480P","流畅 360P"],
// "accept_quality":[127,120,112,80,48,32,16],
api, err := genAPI(options.aid, options.cid, 127, options.bvid, options.bangumi, extractOption.Cookie)
if err != nil {
return types.EmptyData(options.url, err)
}
Expand Down
7 changes: 7 additions & 0 deletions extractors/bilibili/bilibili_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ func TestBilibili(t *testing.T) {
Title: "你的名字。",
},
},
{
name: "8k test",
args: test.Args{
URL: "https://www.bilibili.com/video/BV1qM4y1w716",
Title: "【8K演示片】B站首发!你的设备还顶得住吗?",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions extractors/bilibili/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type dash struct {
}

var qualityString = map[int]string{
127: "超高清 8K",
120: "超清 4K",
116: "高清 1080P60",
74: "高清 720P60",
Expand Down