soundcloud

package
v1.26.2 Latest Latest
Warning

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

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

README

SoundCloud

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"
)

Variables

This section is empty.

Functions

This section is empty.

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 TrackID added in v1.25.4

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

func TrackURL added in v1.25.4

func TrackURL(addr 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. "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