Documentation ¶
Index ¶
- Constants
- Variables
- func NewClientIDFromPublicHTML() (string, error)
- type Client
- type Collection
- type CollectionQuery
- type Format
- type Media
- type PlayHistory
- type Playlist
- type PlaylistService
- type PlaylistsLikedOwned
- type PublisherMetadata
- type StreamType
- type Track
- type TrackService
- func (ts *TrackService) FromTrack(t *Track, fetch bool) (*TrackService, *Track, error)
- func (ts *TrackService) FromURL(url string) (*TrackService, *Track, error)
- func (s TrackService) Get(out interface{}) error
- func (s *TrackService) Limit(limit int)
- func (s *TrackService) Offset(offset int)
- func (ts *TrackService) Stream(st StreamType) (string, error)
- func (ts *TrackService) WithID(id string) *TrackService
- type Tracks
- type Transcodings
- type User
- type UserService
Constants ¶
const ( UserPath = "/users/{userID}" UserLikesPath = UserPath + "/track_likes" )
const (
PlaylistPath = "/playlists/{playlistID}"
)
const (
TrackPath = "/tracks"
)
Variables ¶
var ( HLSMP3 = StreamType{Protocol: "hls", PresetPrefix: "mp3"} ProgressiveMP3 = StreamType{Protocol: "progressive", PresetPrefix: "mp3"} Opus = StreamType{Protocol: "hls", PresetPrefix: "opus"} )
Functions ¶
func NewClientIDFromPublicHTML ¶
NewClientIDFromPublicHTML allow to retrieve a token from the public page of SoundCloud.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewAutoIDClient ¶
NewAutoIDClient will fetch a client ID from soundcloud's homepage and create a new client using this client ID
func (*Client) Playlist ¶
func (c *Client) Playlist() *PlaylistService
Playlist will create a new playlist service
func (*Client) Track ¶
func (c *Client) Track() *TrackService
func (*Client) User ¶
func (c *Client) User(id string) *UserService
type Collection ¶
type CollectionQuery ¶
type CollectionQuery struct { Collection []Collection `json:"collection"` NextHref string `json:"next_href"` QueryUrn interface{} `json:"query_urn"` }
type Media ¶
type Media struct {
Transcodings []Transcodings `json:"transcodings"`
}
type PlayHistory ¶
type Playlist ¶
type Playlist struct { ArtworkURL string `json:"artwork_url"` CreatedAt time.Time `json:"created_at"` Description interface{} `json:"description"` Duration int `json:"duration"` EmbeddableBy string `json:"embeddable_by"` Genre string `json:"genre"` ID int `json:"id"` Kind string `json:"kind"` LabelName interface{} `json:"label_name"` LastModified time.Time `json:"last_modified"` License string `json:"license"` LikesCount int `json:"likes_count"` ManagedByFeeds bool `json:"managed_by_feeds"` Permalink string `json:"permalink"` PermalinkURL string `json:"permalink_url"` Public bool `json:"public"` PurchaseTitle interface{} `json:"purchase_title"` PurchaseURL interface{} `json:"purchase_url"` ReleaseDate interface{} `json:"release_date"` RepostsCount int `json:"reposts_count"` SecretToken interface{} `json:"secret_token"` Sharing string `json:"sharing"` TagList string `json:"tag_list"` Title string `json:"title"` URI string `json:"uri"` UserID int `json:"user_id"` SetType string `json:"set_type"` IsAlbum bool `json:"is_album"` PublishedAt time.Time `json:"published_at"` DisplayDate time.Time `json:"display_date"` User struct { AvatarURL string `json:"avatar_url"` FirstName string `json:"first_name"` FullName string `json:"full_name"` ID int `json:"id"` Kind string `json:"kind"` LastModified time.Time `json:"last_modified"` LastName string `json:"last_name"` Permalink string `json:"permalink"` PermalinkURL string `json:"permalink_url"` URI string `json:"uri"` Urn string `json:"urn"` Username string `json:"username"` Verified bool `json:"verified"` City interface{} `json:"city"` CountryCode interface{} `json:"country_code"` Badges struct { ProUnlimited bool `json:"pro_unlimited"` Verified bool `json:"verified"` } `json:"badges"` } `json:"user"` Tracks Tracks `json:"tracks"` TrackCount int `json:"track_count"` }
type PlaylistService ¶
type PlaylistService struct {
// contains filtered or unexported fields
}
PlaylistService is the structure holding information about the current playlist operation
func (*PlaylistService) FromURL ¶
func (ps *PlaylistService) FromURL(url string) (*PlaylistService, error)
FromURL will set the current playlist ID according to the provided URL This function will fetch the given URL and attempt to find a meta tag containing said ID If it fails, an error will always be returned
func (*PlaylistService) Get ¶
func (ps *PlaylistService) Get() (*Playlist, error)
Get will fetch all the information about a playlist including all of its tracks. The first few tracks are already filled during the first request, the rest of the tracks needs to be fetched with another query WithID or FromURL must be called beforehand
func (*PlaylistService) WithID ¶
func (ps *PlaylistService) WithID(id string) *PlaylistService
WithID will set the current playlist ID to the given value
type PlaylistsLikedOwned ¶
type PlaylistsLikedOwned struct { Collection []Collection `json:"collection"` NextHref string `json:"next_href"` QueryUrn interface{} `json:"query_urn"` }
type PublisherMetadata ¶
type StreamType ¶
type Track ¶
type Track struct { Playlist *Playlist ArtworkURL string `json:"artwork_url,omitempty"` Caption interface{} `json:"caption,omitempty"` Commentable bool `json:"commentable,omitempty"` CommentCount int `json:"comment_count,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` Description string `json:"description,omitempty"` Downloadable bool `json:"downloadable,omitempty"` DownloadCount int `json:"download_count,omitempty"` Duration int `json:"duration,omitempty"` FullDuration int `json:"full_duration,omitempty"` EmbeddableBy string `json:"embeddable_by,omitempty"` Genre string `json:"genre,omitempty"` HasDownloadsLeft bool `json:"has_downloads_left,omitempty"` ID int `json:"id"` Kind string `json:"kind"` LabelName interface{} `json:"label_name,omitempty"` LastModified time.Time `json:"last_modified,omitempty"` License string `json:"license,omitempty"` LikesCount int `json:"likes_count,omitempty"` Permalink string `json:"permalink,omitempty"` PermalinkURL string `json:"permalink_url,omitempty"` PlaybackCount int `json:"playback_count,omitempty"` Public bool `json:"public,omitempty"` PurchaseTitle string `json:"purchase_title,omitempty"` PurchaseURL string `json:"purchase_url,omitempty"` ReleaseDate time.Time `json:"release_date,omitempty"` RepostsCount int `json:"reposts_count,omitempty"` SecretToken interface{} `json:"secret_token,omitempty"` Sharing string `json:"sharing,omitempty"` State string `json:"state,omitempty"` Streamable bool `json:"streamable,omitempty"` TagList string `json:"tag_list,omitempty"` Title string `json:"title,omitempty"` URI string `json:"uri,omitempty"` Urn string `json:"urn,omitempty"` UserID int `json:"user_id,omitempty"` Visuals interface{} `json:"visuals,omitempty"` WaveformURL string `json:"waveform_url,omitempty"` DisplayDate time.Time `json:"display_date,omitempty"` Media struct { Transcodings []struct { URL string `json:"url"` Preset string `json:"preset"` Duration int `json:"duration"` Snipped bool `json:"snipped"` Format struct { Protocol string `json:"protocol"` MimeType string `json:"mime_type"` } `json:"format"` Quality string `json:"quality"` } `json:"transcodings"` } `json:"media,omitempty"` MonetizationModel string `json:"monetization_model"` Policy string `json:"policy"` User struct { AvatarURL string `json:"avatar_url"` FirstName string `json:"first_name"` FullName string `json:"full_name"` ID int `json:"id"` Kind string `json:"kind"` LastModified time.Time `json:"last_modified"` LastName string `json:"last_name"` Permalink string `json:"permalink"` PermalinkURL string `json:"permalink_url"` URI string `json:"uri"` Urn string `json:"urn"` Username string `json:"username"` Verified bool `json:"verified"` City string `json:"city"` CountryCode interface{} `json:"country_code"` Badges struct { ProUnlimited bool `json:"pro_unlimited"` Verified bool `json:"verified"` } `json:"badges"` } `json:"user,omitempty"` PublisherMetadata PublisherMetadata `json:"publisher_metadata,omitempty"` }
type TrackService ¶
type TrackService struct {
// contains filtered or unexported fields
}
func (*TrackService) FromTrack ¶
func (ts *TrackService) FromTrack(t *Track, fetch bool) (*TrackService, *Track, error)
func (*TrackService) FromURL ¶
func (ts *TrackService) FromURL(url string) (*TrackService, *Track, error)
func (*TrackService) Stream ¶
func (ts *TrackService) Stream(st StreamType) (string, error)
func (*TrackService) WithID ¶
func (ts *TrackService) WithID(id string) *TrackService
type Transcodings ¶
type User ¶
type User struct { AvatarURL string `json:"avatar_url"` City interface{} `json:"city"` CommentsCount int `json:"comments_count"` CountryCode interface{} `json:"country_code"` CreatedAt time.Time `json:"created_at"` CreatorSubscriptions []struct { Product struct { ID string `json:"id"` } `json:"product"` } `json:"creator_subscriptions"` CreatorSubscription struct { Product struct { ID string `json:"id"` } `json:"product"` } `json:"creator_subscription"` Description interface{} `json:"description"` FollowersCount int `json:"followers_count"` FollowingsCount int `json:"followings_count"` FirstName string `json:"first_name"` FullName string `json:"full_name"` GroupsCount int `json:"groups_count"` ID int `json:"id"` Kind string `json:"kind"` LastModified time.Time `json:"last_modified"` LastName string `json:"last_name"` LikesCount int `json:"likes_count"` PlaylistLikesCount int `json:"playlist_likes_count"` Permalink string `json:"permalink"` PermalinkURL string `json:"permalink_url"` PlaylistCount int `json:"playlist_count"` RepostsCount interface{} `json:"reposts_count"` TrackCount int `json:"track_count"` URI string `json:"uri"` Urn string `json:"urn"` Username string `json:"username"` Verified bool `json:"verified"` Visuals struct { Urn string `json:"urn"` Enabled bool `json:"enabled"` Visuals []struct { Urn string `json:"urn"` EntryTime int `json:"entry_time"` VisualURL string `json:"visual_url"` } `json:"visuals"` } `json:"visuals"` }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func (*UserService) Get ¶
func (us *UserService) Get() (*User, error)
func (*UserService) Likes ¶
func (us *UserService) Likes() (Tracks, error)
func (*UserService) Limit ¶
func (us *UserService) Limit(limit int) *UserService
func (*UserService) Offset ¶
func (us *UserService) Offset(offset int) *UserService
func (*UserService) Playlists ¶
func (us *UserService) Playlists() ([]Playlist, error)