Fixed bandcamp to return albums and tracks instead of bands in music search
Some checks failed
Run Integration Tests / test (push) Failing after 3m3s
Some checks failed
Run Integration Tests / test (push) Failing after 3m3s
This commit is contained in:
parent
5032173609
commit
ed588e8764
1 changed files with 8 additions and 0 deletions
|
@ -31,6 +31,14 @@ func SearchBandcamp(query string, page int) ([]MusicResult, error) {
|
||||||
var results []MusicResult
|
var results []MusicResult
|
||||||
|
|
||||||
doc.Find("li.searchresult").Each(func(i int, s *goquery.Selection) {
|
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"}
|
result := MusicResult{Source: "Bandcamp"}
|
||||||
|
|
||||||
// URL extraction
|
// URL extraction
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue