Skip to content

Commit 79cc70b

Browse files
committed
check has_downloads_left
1 parent bff0fe6 commit 79cc70b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Track struct {
99
CommentCount int64 `json:"comment_count"`
1010
FullDurationMS int64 `json:"full_duration"`
1111
Downloadable bool `json:"downloadable"`
12+
HasDownloadsLeft bool `json:"has_downloads_left"`
1213
CreatedAt string `json:"created_at"`
1314
Description string `json:"description"`
1415
Media Media `json:"media"`

soundcloudapi.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func (sc *API) GetDownloadURL(url string, streamType string) (string, error) {
155155
return "", errors.New("Could not find a track with that URL")
156156
}
157157

158-
if info[0].Downloadable {
158+
if info[0].Downloadable && info[0].HasDownloadsLeft {
159159
downloadURL, err := sc.client.getDownloadURL(info[0].ID)
160160
if err != nil {
161161
return "", err

0 commit comments

Comments
 (0)