
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
A lousy and very badly programmed Spotify API Client written in Ruby.
If you'd rather have a proper, working, supported library I do recommend RSpotify.
Seriously, don't just run gem install simplespotify
, it'll ruin your day.
You've suffered enough registering an app with Spotify and setting up your redirection URIs, why would you want to...?
client = SimpleSpotify::Client.new(client_id, client_secret)
redirect_uri = 'http://your-redirect-uri'
if ARGV[0] == 'login'
login_url = SimpleSpotify::Authorization.login_uri redirect_uri, client, scope: 'playlist-modify-public user-read-private'
puts login_url
elsif ARGV[0] == 'code'
# Copy the `code` param from your browser...
code = ARGV[1].strip
auth = SimpleSpotify::Authorization.from_code code, client: client, redirect: redirect_uri
puts auth.to_h
else
# now do the same for the `access_token` and `refresh_token`
token = ARGV[0]
refresh_token = ARGV[1]
client.session = SimpleSpotify::Authorization.new access_token: token, refresh_token: refresh_token, client: client
me = client.me
puts me.to_h
end
It's all syntactic sugar, but not the right kind that makes you happy and stuff, but the distasteful one that comes with coffee in an airplane. Seriously, it's not even properly tested!
playlist = client.playlist(some_user_id, some_playlist_id)
if playlist.tracks.total >= 10
extra = (playlist.tracks.total - 10)
playlist.remove_tracks positions: (0..extra).to_a
end
playlist.add_tracks('spotify:track:1SWhZ2rIxTPv9UcexFnPSU')
# or
client.playlist_tracks_add(playlist, tracks: '1SWhZ2rIxTPv9UcexFnPSU'})
# or even
client.post "/user/#{_user_}/playlists/#{_playlist_id_}/tracks", {uris: ['spotify:track:1SWhZ2rIxTPv9UcexFnPSU']}
client.session.on_refresh do |sess|
# Then token was refreshed on the last call
cache[:spotify_session] = sess.to_h
end
# And maybe later...
credentials = cache[:spotify_session]
credentials[:client] = client
client.session = SimpleSpotify::Authorization.new(credentials)
FAQs
Unknown package
We found that simplespotify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.