Documentation
¶
Overview ¶
Package bcscrape implements a simple scraper for bandcamp.com pages
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetermineType ¶
DetermineType takes a url and determines what type of page it refers to and also returns a normalized URL (eg, an artist '/releases' page often contains the data of the most recently released album page, so it normalizes to that album page's URL)
Example (Album) ¶
package main
import (
"fmt"
"github.com/thraxil/bcscrape"
)
func main() {
fmt.Println(bcscrape.DetermineType("https://solstafir.bandcamp.com/album/berdreyminn"))
}
Output: album https://solstafir.bandcamp.com/album/berdreyminn
Example (Artist) ¶
package main
import (
"fmt"
"github.com/thraxil/bcscrape"
)
func main() {
fmt.Println(bcscrape.DetermineType("https://solstafir.bandcamp.com/"))
}
Output: band https://solstafir.bandcamp.com
Example (Releases) ¶
package main
import (
"fmt"
"github.com/thraxil/bcscrape"
)
func main() {
fmt.Println(bcscrape.DetermineType("https://solstafir.bandcamp.com/releases"))
}
Output: album https://solstafir.bandcamp.com/album/berdreyminn
Types ¶
type AlbumPage ¶
type AlbumPage struct {
URL string
Artist string
ArtistURL string
Title string
Description string
CoverSRC string
Published string
}
AlbumPage represents an album page
Example ¶
package main
import (
"fmt"
"github.com/thraxil/bcscrape"
)
func main() {
a := bcscrape.NewAlbumPage("https://solstafir.bandcamp.com/album/berdreyminn")
a.Fetch()
fmt.Println(a.Title)
fmt.Println(a.Artist)
}
Output: Berdreyminn Sólstafir
func NewAlbumPage ¶
NewAlbumPage is the constructor for AlbumPage
Click to show internal directories.
Click to hide internal directories.