basic album fetching
This commit is contained in:
@@ -85,6 +85,42 @@ func parseArtistContact(contact *goquery.Selection) data.Artist {
|
||||
func parseAlbumContact(contact *goquery.Selection) data.Album {
|
||||
album := data.Album{}
|
||||
|
||||
/*
|
||||
<div class="contacts__item">
|
||||
<a href="/release/ghost-bath-ghost-bath-2013-602489" title="Ghost Bath - 2013">
|
||||
|
||||
<div class="contacts__img release">
|
||||
<img alt="Ghost Bath" class="lozad" data-src="https://37s.musify.club/img/69/9060265/24178833.jpg"/>
|
||||
<noscript><img alt="Ghost Bath" src="https://37s.musify.club/img/69/9060265/24178833.jpg"/></noscript>
|
||||
</div>
|
||||
|
||||
<div class="contacts__info">
|
||||
<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>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
*/
|
||||
|
||||
anchor := contact.Find("a")
|
||||
if anchor.Length() > 0 {
|
||||
if url, urlExists := anchor.Attr("href"); urlExists {
|
||||
album.Sources = append(album.Sources, data.Source{
|
||||
Url: musifyHost + url,
|
||||
ObjectType: data.ArtistSource,
|
||||
})
|
||||
}
|
||||
|
||||
if titleDate, titleExists := anchor.Attr("title"); titleExists {
|
||||
delimiter := " - "
|
||||
|
||||
splitAttr := strings.Split(strings.TrimSpace(titleDate), delimiter)
|
||||
album.Name = strings.Join(splitAttr[:len(splitAttr)-1], delimiter)
|
||||
}
|
||||
}
|
||||
|
||||
return album
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user