diff --git a/internal/cli/shell.go b/internal/cli/shell.go index ab4eb4d..0f25217 100644 --- a/internal/cli/shell.go +++ b/internal/cli/shell.go @@ -54,5 +54,6 @@ func Shell() { fmt.Println() printResults(searchResults) + fmt.Println() } } diff --git a/internal/plugin/musify.go b/internal/plugin/musify.go index a5c140a..4602615 100644 --- a/internal/plugin/musify.go +++ b/internal/plugin/musify.go @@ -1,7 +1,6 @@ package plugin import ( - "fmt" "regexp" "strings" @@ -121,6 +120,43 @@ func parseAlbumContact(contact *goquery.Selection) data.Album { } } + contactInfo := contact.Find("div.contacts__info") + if contactInfo.Length() > 0 { + /* + Ghost Bath - 2013 + Ghost Bath + Треков: 4 + 9,04 + */ + + // titleSoup := contactInfo.Find("strong") + + smallList := contactInfo.Find("small") + if smallList.Length() == 3 { + // artist + rawArtistStr := smallList.First().Text() + + for _, artistStr := range strings.Split(rawArtistStr, "&") { + artistStr = strings.TrimRight(artistStr, "& ...\r\n") + artistStr = strings.TrimSpace(artistStr) + + if strings.HasSuffix(artistStr, "]") && strings.Contains(artistStr, "[") { + parts := strings.Split(artistStr, "[") + if len(parts) > 1 { + artistStr = strings.TrimSpace(parts[0]) + } + } + + album.Artists = append(album.Artists, data.Artist{ + Name: artistStr, + }) + } + + // trackCountSoup := smallList[1] + // ratingSoup := smallList[2] + } + } + return album } @@ -162,9 +198,6 @@ func (m *Musify) Search(query common.Query) ([]data.MusicObject, error) { return musicObjects, err } - fmt.Println(resp.Header) - fmt.Println(resp.StatusCode) - doc, err := scraper.GetHtml(resp) if err != nil { return musicObjects, err