ShazamKit
Elixir client for the ShazamKit API.
It covers the server-side Shazam catalog endpoints used for:
- matching a Shazam audio signature
- searching by ISRC
- searching tracks by text
- retrieving track details
Installation
Add to your mix.exs:
defp deps do
[
{:shazam_kit, "~> 0.1.0"}
]
endConfiguration
config :shazam_kit,
team_id: System.get_env("APPLE_TEAM_ID"),
key_id: System.get_env("SHAZAM_KEY_ID"),
private_key_path: System.get_env("SHAZAM_PRIVATE_KEY_PATH")Supported options:
team_id- Apple Developer Team IDkey_id- ShazamKit key IDprivate_key- inline.p8contentsprivate_key_path- path to the.p8filebase_url- defaults tohttps://api.shazam.comtoken_ttl_seconds- defaults to1200
Quick Start
# Match a client-generated signature
{:ok, result} = ShazamKit.match_signature(signature)
# Search by ISRC
{:ok, result} = ShazamKit.search_by_isrc("USUG12002836")
# Search tracks by text
{:ok, result} = ShazamKit.search_tracks("The Beatles", limit: 5)
# Fetch a track by Shazam ID
{:ok, track} = ShazamKit.get_track("548587123")Audio Signatures
This library does not generate Shazam signatures itself.
Generate signatures on the client side with:
-
Appleās
SHSignatureGeneratoron iOS - a supported Shazam SDK integration on other platforms
Then send the base64 signature to your Elixir service.
Notes
match_signature/2accepts either a base64 signature or raw binary withraw_audio: true.get_chart/1andlist_cities/1are included, but availability may vary by endpoint and account access.-
Tokens are cached in
ShazamKit.TokenCache.
License
MIT