Module: Shazamio::ShazamUrl

Defined in:
lib/shazamio/urls.rb

Overview

Endpoint URL templates, ported from the Python client's ShazamUrl. %{...} placeholders are filled in with String#% at call sites.

NOTE: the Python source also defines TOP_TRACKS_PLAYLIST, LOCATIONS, SEARCH_ARTIST_V2 (artist info), ARTIST_ALBUMS, and ARTIST_ALBUM_INFO -- all under https://www.shazam.com/services/amapi/v1/catalog/... . That whole amapi catalog path is currently rejecting GET requests with a 405 on Shazam's own servers (confirmed: shazam.com's own web app hits the same 405 on this path). Since there's nothing a client can do about a server-side 405, those routes were left out here rather than shipped broken. See README.md ("Not included") for the exact URLs, in case Apple fixes this and someone wants to add them back.

Constant Summary collapse

SEARCH_FROM_FILE =
"https://amp.shazam.com/discovery/v5/%<language>s/%<endpoint_country>s/%<device>s/-/tag" \
"/%<uuid_1>s/%<uuid_2>s?sync=true&webv3=true&sampling=true" \
"&connected=&shazamapiversion=v3&sharehub=true&hubv5minorversion=v5.1&hidelb=true&video=v3"
ABOUT_TRACK =
"https://www.shazam.com/discovery/v5/%<language>s/%<endpoint_country>s/web/-/track" \
"/%<track_id>s?shazamapiversion=v3&video=v3"
"https://cdn.shazam.com/shazam/v3/%<language>s/%<endpoint_country>s/web/-/tracks" \
"/track-similarities-id-%<track_id>s?startFrom=%<offset>s&pageSize=%<limit>s&connected=&channel="
SEARCH_ARTIST =
"https://www.shazam.com/services/search/v4/%<language>s/%<endpoint_country>s/web" \
"/search?term=%<query>s&limit=%<limit>s&offset=%<offset>s&types=artists"
SEARCH_MUSIC =
"https://www.shazam.com/services/search/v3/%<language>s/%<endpoint_country>s/web" \
"/search?query=%<query>s&numResults=%<limit>s&offset=%<offset>s&types=songs"
LISTENING_COUNTER =
"https://www.shazam.com/services/count/v2/web/track/%<track_id>s"
LISTENING_COUNTER_MANY =
"https://www.shazam.com/services/count/v2/web/track"