diff --git a/integrations/playback/allanime/sources.go b/integrations/playback/allanime/sources.go index c684534..6341e91 100644 --- a/integrations/playback/allanime/sources.go +++ b/integrations/playback/allanime/sources.go @@ -194,8 +194,11 @@ func buildSourceReferences(rawSourceURLs []any) []sourceReference { continue } - sourceURL, _ := item["sourceUrl"].(string) - sourceName, _ := item["sourceName"].(string) + sourceURL, ok := stringMapValue(item, "sourceUrl") + if !ok { + continue + } + sourceName, _ := stringMapValue(item, "sourceName") sourceURL = strings.TrimSpace(sourceURL) sourceName = strings.TrimSpace(sourceName) if sourceURL == "" { @@ -230,6 +233,11 @@ func buildSourceReferences(rawSourceURLs []any) []sourceReference { return ordered } +func stringMapValue(item map[string]any, key string) (string, bool) { + value, ok := item[key].(string) + return value, ok +} + func (c *AllAnimeProvider) graphqlRequestWithHash(ctx context.Context, showID, episode, mode string) (map[string]any, error) { req, err := newEpisodeHashRequest(ctx, showID, episode, mode) if err != nil {