Add stream not available with non-premium error notice

This commit is contained in:
bytedream 2022-05-16 22:06:44 +02:00
parent f51bdeaec7
commit 5b3466d06d

View file

@ -80,9 +80,13 @@ func fromVideoStreams(crunchy *Crunchyroll, endpoint string) (streams []*Stream,
json.NewDecoder(resp.Body).Decode(&jsonBody)
if len(jsonBody) == 0 {
// this may get thrown when the crunchyroll account has just a normal account and not one with premium
// this may get thrown when the crunchyroll account is just a normal account and not one with premium
if !crunchy.Config.Premium {
return nil, fmt.Errorf("no stream available, this might be the result of using a non-premium account")
} else {
return nil, errors.New("no stream available")
}
}
audioLocale := jsonBody["audio_locale"].(string)