Skip to content

Commit

Permalink
feat: provide url for playlist
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Gleich <[email protected]>
  • Loading branch information
gleich committed Jan 4, 2025
1 parent b5c9955 commit efcc463
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/apis/applemusic/playlists.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type playlist struct {
Name string `json:"name"`
Tracks []song `json:"tracks"`
LastModified time.Time `json:"last_modified"`
URL string `json:"url"`
ID string `json:"id"`
}

Expand All @@ -38,6 +39,9 @@ type playlistResponse struct {
Attributes struct {
LastModifiedDate time.Time `json:"lastModifiedDate"`
Name string `json:"name"`
PlayParams struct {
GlobalID string `json:"globalId"`
} `json:"playParams"`
} `json:"attributes"`
} `json:"data"`
}
Expand Down Expand Up @@ -82,6 +86,10 @@ func fetchPlaylist(id string) (playlist, error) {
LastModified: playlistData.Data[0].Attributes.LastModifiedDate,
Tracks: tracks,
ID: playlistData.Data[0].ID,
URL: fmt.Sprintf(
"https://music.apple.com/us/playlist/alt/%s",
playlistData.Data[0].Attributes.PlayParams.GlobalID,
),
}, nil
}

Expand Down

0 comments on commit efcc463

Please sign in to comment.