mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Fix crunchyroll api changes
This commit is contained in:
parent
a64981930b
commit
6239d10d22
3 changed files with 22 additions and 55 deletions
|
|
@ -28,7 +28,6 @@ func ExtractEpisodes(url string, locales ...crunchyroll.LOCALE) ([][]*crunchyrol
|
|||
url = url[:lastOpen]
|
||||
}
|
||||
|
||||
final := make([][]*crunchyroll.Episode, len(locales))
|
||||
episodes, err := Crunchy.ExtractEpisodesFromUrl(url, locales...)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get episodes: %v", err)
|
||||
|
|
@ -82,12 +81,18 @@ func ExtractEpisodes(url string, locales ...crunchyroll.LOCALE) ([][]*crunchyrol
|
|||
}
|
||||
}
|
||||
|
||||
localeSorted, err := utils.SortEpisodesByAudio(episodes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get audio locale: %v", err)
|
||||
}
|
||||
for i, locale := range locales {
|
||||
final[i] = append(final[i], localeSorted[locale]...)
|
||||
var final [][]*crunchyroll.Episode
|
||||
if len(locales) > 0 {
|
||||
final = make([][]*crunchyroll.Episode, len(locales))
|
||||
localeSorted, err := utils.SortEpisodesByAudio(episodes)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get audio locale: %v", err)
|
||||
}
|
||||
for i, locale := range locales {
|
||||
final[i] = append(final[i], localeSorted[locale]...)
|
||||
}
|
||||
} else {
|
||||
final = [][]*crunchyroll.Episode{episodes}
|
||||
}
|
||||
|
||||
return final, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue