soundcloud

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractSong

func ExtractSong(url string)

ExtractSong queries the SoundCloud api and receives a m3u8 file, then binds the segments received into a .mp3 file

func GetArtwork

func GetArtwork(data []byte) (string, []byte)

GetArtwork returns the song artwork url and image

func GetClientID

func GetClientID(data []byte) string

GetClientID returns a the new generated client_id when a request is made to SoundCloud's API TODO implment tests

func GetTitle

func GetTitle(data []byte) string

GetTitle returns title of the song TODO: implement tests

func Search(query string) string

Search returns the first URL on SoundCloud most similar to the user input TODO implment tests

Types

type AudioLink struct {
	URL string `json:"url"`
}

AudioLink struct for unmarshalling data

type Soundcloud

type Soundcloud struct {
	Client *http.Client // http client
	// contains filtered or unexported fields
}

Soundcloud struct represents a http client to make requests to SoundCloud's API

func NewClient

func NewClient() *Soundcloud

NewClient returns a new Soundcloud client

func (*Soundcloud) ConstructStreamURL

func (s *Soundcloud) ConstructStreamURL(doc *html.Node) (string, error)

ConstructStreamURL will construct a stream url from a SoundCloud song url

func (*Soundcloud) GetArtwork

func (s *Soundcloud) GetArtwork(doc *html.Node) (string, error)

func (*Soundcloud) GetClientID

func (s *Soundcloud) GetClientID() (string, error)

GetClientID returns a new generated client_id when a request is made to SoundCloud's API

func (*Soundcloud) GetHLSURL

func (s *Soundcloud) GetHLSURL(doc *html.Node) (string, error)

GetHLSURL gets the HLS URL from the SoundCloud song URL

func (*Soundcloud) GetTitle

func (s *Soundcloud) GetTitle(doc *html.Node) (string, error)

GetTitle will return the title of the song

func (*Soundcloud) GetTrackAuthorization

func (s *Soundcloud) GetTrackAuthorization(doc *html.Node) (string, error)

GetTrackAuthorization will get the track authorization URL from the SoundCloud song URL

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL