bcscrape: github.com/thraxil/bcscrape Index | Examples | Files

package bcscrape

import "github.com/thraxil/bcscrape"

Package bcscrape implements a simple scraper for bandcamp.com pages

Index

Examples

Package Files

bcscrape.go

func DetermineType Uses

func DetermineType(url string) (string, string)

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)

Code:

fmt.Println(bcscrape.DetermineType("https://solstafir.bandcamp.com/album/berdreyminn"))

Output:

album https://solstafir.bandcamp.com/album/berdreyminn

Code:

fmt.Println(bcscrape.DetermineType("https://solstafir.bandcamp.com/"))

Output:

band https://solstafir.bandcamp.com

Code:

fmt.Println(bcscrape.DetermineType("https://solstafir.bandcamp.com/releases"))

Output:

album https://solstafir.bandcamp.com/album/berdreyminn

type AlbumPage Uses

type AlbumPage struct {
    URL         string
    Artist      string
    ArtistURL   string
    Title       string
    Description string
    CoverSRC    string
    Published   string
}

AlbumPage represents an album page

Code:

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 Uses

func NewAlbumPage(url string) *AlbumPage

NewAlbumPage is the constructor for AlbumPage

func (*AlbumPage) Fetch Uses

func (a *AlbumPage) Fetch()

Fetch makes the HTTP request and populates the data fields

type Page Uses

type Page struct {
    URL          string
    Type         string
    NormativeURL string
}

Page represents an unknown type of bandcamp page

func NewPage Uses

func NewPage(url string) *Page

NewPage is a Page constructor

func (*Page) Fetch Uses

func (p *Page) Fetch()

Fetch makes the HTTP request and populates the Type and NormativeURL fields

type TrackPage Uses

type TrackPage struct {
    URL       string
    Title     string
    Artist    string
    ArtistURL string
    Album     string
    AlbumURL  string
    CoverSRC  string
    Published string
}

TrackPage represents a track page

func NewTrackPage Uses

func NewTrackPage(url string) *TrackPage

NewTrackPage is the constructor for TrackPage

func (*TrackPage) Fetch Uses

func (t *TrackPage) Fetch()

Fetch makes the HTTP request and populates the data fields

Package bcscrape imports 3 packages (graph). Updated 2017-12-28. Refresh now. Tools for package owners.