From ed588e87644fc3239d889a99996a41d9e858ea80 Mon Sep 17 00:00:00 2001 From: partisan <none@noone.no> Date: Sat, 31 May 2025 11:02:32 +0200 Subject: [PATCH] Fixed bandcamp to return albums and tracks instead of bands in music search --- music-bandcamp.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/music-bandcamp.go b/music-bandcamp.go index 2c3210f..95922ae 100644 --- a/music-bandcamp.go +++ b/music-bandcamp.go @@ -31,6 +31,14 @@ func SearchBandcamp(query string, page int) ([]MusicResult, error) { var results []MusicResult doc.Find("li.searchresult").Each(func(i int, s *goquery.Selection) { + // Extract the item type + itemType := strings.ToLower(strings.TrimSpace(s.Find("div.itemtype").Text())) + + // Skip if the item is not an album or track + if itemType != "album" && itemType != "track" { + return + } + result := MusicResult{Source: "Bandcamp"} // URL extraction