Last active
January 11, 2021 16:15
-
-
Save ongaeshi/c23b669c7dd2fcb3668c800f15128f23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_recent_tracks(token) | |
URI.open("https://api.spotify.com/v1/me/player/recently-played", "Authorization" => "Bearer #{token}") do |f| | |
JSON.load(f.read)["items"].map do |e| | |
e = e["track"] | |
"#{e["name"]} - #{e["artists"][0]["name"]}" | |
end | |
end | |
end | |
TOKEN = 'XXXXXXXXXX' | |
puts get_recent_tracks(TOKEN) |
Author
ongaeshi
commented
Jan 11, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment