fetching of albums
This commit is contained in:
@@ -54,5 +54,6 @@ func Shell() {
|
|||||||
|
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
printResults(searchResults)
|
printResults(searchResults)
|
||||||
|
fmt.Println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package plugin
|
package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -121,6 +120,43 @@ func parseAlbumContact(contact *goquery.Selection) data.Album {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
contactInfo := contact.Find("div.contacts__info")
|
||||||
|
if contactInfo.Length() > 0 {
|
||||||
|
/*
|
||||||
|
<strong>Ghost Bath - 2013</strong>
|
||||||
|
<small>Ghost Bath</small>
|
||||||
|
<small>Треков: 4</small> <!--tracks-->
|
||||||
|
<small><i class="zmdi zmdi-star zmdi-hc-fw"></i> 9,04</small>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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
|
return album
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,9 +198,6 @@ func (m *Musify) Search(query common.Query) ([]data.MusicObject, error) {
|
|||||||
return musicObjects, err
|
return musicObjects, err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(resp.Header)
|
|
||||||
fmt.Println(resp.StatusCode)
|
|
||||||
|
|
||||||
doc, err := scraper.GetHtml(resp)
|
doc, err := scraper.GetHtml(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return musicObjects, err
|
return musicObjects, err
|
||||||
|
|||||||
Reference in New Issue
Block a user