soundcloud

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: OSL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const Origin = "https://api-v2.soundcloud.com"

Variables

This section is empty.

Functions

func ClientID added in v1.25.1

func ClientID() (string, error)

Fetch a SoundCloud client ID. The basic notion of how this function works is that SoundCloud provides a client ID so its web app can make API requests. This client ID (along with other intialization data for the web app) is provided in a JavaScript file imported through a <script> tag in the HTML. This function scrapes the HTML and tries to find the URL to that JS file, and then scrapes the JS file to find the client ID.

Types

type Media

type Media struct {
	URL string
}

MediaURLResponse is the JSON response of retrieving media information of a track

type Track

type Track struct {
	// Media contains an array of transcoding for a track
	Media struct {
		// Transcoding contains information about the transcoding of a track
		Transcodings []struct {
			// TranscodingFormat contains the protocol by which the track is
			// delivered ("progressive" or "HLS"), and the mime type of the track
			Format struct {
				Protocol string
			}
			URL string
		}
	}
}

Track represents the JSON response of a track's info

func NewTrack added in v1.25.1

func NewTrack(id, addr string) (*Track, error)

func (Track) GetMedia added in v1.25.1

func (t Track) GetMedia(id string) (*Media, error)

The media URL is the actual link to the audio file for the track. "addr" is Track.Media.Transcodings[0].URL

Jump to

Keyboard shortcuts

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