Handle AllAnime source assertions

This commit is contained in:
2026-06-20 18:29:02 +02:00
committed by Milas Holsting
parent 0c685e6c09
commit 0acefe636e

View File

@@ -194,8 +194,11 @@ func buildSourceReferences(rawSourceURLs []any) []sourceReference {
continue continue
} }
sourceURL, _ := item["sourceUrl"].(string) sourceURL, ok := stringMapValue(item, "sourceUrl")
sourceName, _ := item["sourceName"].(string) if !ok {
continue
}
sourceName, _ := stringMapValue(item, "sourceName")
sourceURL = strings.TrimSpace(sourceURL) sourceURL = strings.TrimSpace(sourceURL)
sourceName = strings.TrimSpace(sourceName) sourceName = strings.TrimSpace(sourceName)
if sourceURL == "" { if sourceURL == "" {
@@ -230,6 +233,11 @@ func buildSourceReferences(rawSourceURLs []any) []sourceReference {
return ordered 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) { func (c *AllAnimeProvider) graphqlRequestWithHash(ctx context.Context, showID, episode, mode string) (map[string]any, error) {
req, err := newEpisodeHashRequest(ctx, showID, episode, mode) req, err := newEpisodeHashRequest(ctx, showID, episode, mode)
if err != nil { if err != nil {