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