feat 添加没有获取到字幕的情况
All checks were successful
Build image / build (push) Successful in 35s

This commit is contained in:
timerzz 2024-07-01 18:13:58 +08:00
parent 43ff697450
commit adf418f016

View File

@ -52,6 +52,9 @@ func (c *Client) GetSubtitles(url string) (string, error) {
break break
} }
} }
if subTitlesUrl == "" {
return "", fmt.Errorf("没有找到字幕")
}
subtitles, err := c.callSubtitles(subTitlesUrl) subtitles, err := c.callSubtitles(subTitlesUrl)
if err != nil { if err != nil {
return "", err return "", err
@ -124,6 +127,8 @@ func parseBilibiliUrl(bu string) (vid string, page int, err error) {
if query.Get("p") != "" { if query.Get("p") != "" {
pageStr := query.Get("p") pageStr := query.Get("p")
page, _ = strconv.Atoi(pageStr) page, _ = strconv.Atoi(pageStr)
} else {
page = 1
} }
return vid, page, nil return vid, page, nil
} }