soundcloud

package
v1.27.3 Latest Latest
Warning

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

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

README

SoundCloud

artworks:

https://soundcloud.com/oembed?format=json&url=https://soundcloud.com/western_vinyl/jessica-risker-cut-my-hair

placeholder:

https://soundcloud.com/oembed?format=json&url=https://soundcloud.com/pdis_inpartmaint/harold-budd-perhaps-moss

avatars:

https://soundcloud.com/oembed?format=json&url=https://soundcloud.com/pdis_inpartmaint

How to get client_id

First, make a request like this:

GET / HTTP/2
Host: soundcloud.com

In the HTML response, you should see several JavaScript assets, like this:

<script crossorigin src="https://a-v2.sndcdn.com/assets/2-b0e52b4d.js"></script>
<script crossorigin src="https://a-v2.sndcdn.com/assets/49-4b976e4f.js"></script>

If you download asset 2, you should see this in the response:

?client_id=fSSdm5yTnDka1g0Fz1CO5Yx6z0NbeHAj&

If you download asset 49, you should see this in the response:

client_id:"fSSdm5yTnDka1g0Fz1CO5Yx6z0NbeHAj"

From my testing, asset 2 was smaller. The client_id seems to last at least a year:

https://github.com/flyingrub/scdl/commit/08317287

Documentation

Index

Constants

View Source
const (
	Origin      = "https://api-v2.soundcloud.com"
	Placeholder = "https://soundcloud.com/images/fb_placeholder.png"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alternate added in v1.27.2

type Alternate struct {
	Thumbnail_URL string
	Author_URL    string
}

func Oembed added in v1.26.9

func Oembed(addr string) (*Alternate, error)

type Media

type Media struct {
	URL string
}

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

type Track

type Track struct {
	ID           json.Number
	Title        string
	Display_Date string
	Media        struct {
		Transcodings []struct {
			Format struct {
				Protocol string
			}
			URL string
		}
	}
}

func Resolve added in v1.26.8

func Resolve(addr string) (*Track, error)

func Tracks added in v1.26.8

func Tracks(id string) ([]Track, error)

func (Track) GetMedia added in v1.25.1

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

The media URL is the actual link to the audio file for the track.

Jump to

Keyboard shortcuts

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