crawlora-spotify 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +33 -0
- data/lib/crawlora/spotify/client.rb +348 -0
- data/lib/crawlora/spotify/version.rb +5 -0
- data/lib/crawlora/spotify.rb +2 -0
- metadata +51 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8d239edb516759360d663555e23e446e4e6bb62610522f25cea0ae6897c6e289
|
|
4
|
+
data.tar.gz: 7e821e8395accb1bfd13253beb7daec42ebb2696d58d599009ed62add40e80c1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 700887a4947f240e1d461348063a6ed6e9919de5f5c2fc4d2ea47b9d75232df8eb1cbd53fddf69b98820a5be4abb48918b3ad54f5392c08e3e8a657eaa895d31
|
|
7
|
+
data.tar.gz: 85e6f0f2aa2217c911f42b1da28d67c212409f9a5f86694d1891865b301e8db17d7b64ee11df313f9bcbd4982dfe13a8c10d1c85f4211c4650d6173013677ead
|
data/CHANGELOG.md
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Crawlora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Crawlora Spotify Ruby client
|
|
2
|
+
|
|
3
|
+
This gem calls the Crawlora hosted API at `https://api.crawlora.net/api/v1`. It does not call or scrape Spotify directly. Requests require your Crawlora API key and use your account's service plan.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```ruby
|
|
8
|
+
gem "crawlora-spotify"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Create an account at [crawlora.net](https://crawlora.net/signup?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=spotify-ruby-signup), open the [Crawlora console](https://crawlora.net/app?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=spotify-ruby-console) to get an API key, and set `CRAWLORA_API_KEY` before running the client:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
require "json"
|
|
15
|
+
require "crawlora/spotify"
|
|
16
|
+
|
|
17
|
+
client = Crawlora::Spotify::Client.new
|
|
18
|
+
result = client.request("spotify-search", JSON.parse("{\"q\": \"sample\"}"))
|
|
19
|
+
puts result
|
|
20
|
+
client.close
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Use an operation-specific method for normal calls. `request(operation_id, params = {}, response_type: :auto)` is available for every operation. `response_type: :text` returns raw response text. This gem includes 38 API operations.
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
client = Crawlora::Spotify::Client.new(api_key: ENV.fetch("CRAWLORA_API_KEY"), timeout: 30)
|
|
27
|
+
# client.<operation_method>(<endpoint parameters>)
|
|
28
|
+
client.close
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Client options include `api_key`, `base_url`, and `timeout`. Ruby stdlib provides the HTTP and JSON support.
|
|
32
|
+
|
|
33
|
+
See [Crawlora](https://crawlora.net/?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=spotify-ruby-homepage), the [API documentation](https://crawlora.net/docs?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=spotify-ruby-api-docs), and [the package repository](https://github.com/Crawlora-org/crawlora-spotify) for account setup, the API operation reference, and release history.
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "net/http"
|
|
3
|
+
require "uri"
|
|
4
|
+
|
|
5
|
+
module Crawlora
|
|
6
|
+
module Spotify
|
|
7
|
+
module Errors
|
|
8
|
+
class Error < StandardError
|
|
9
|
+
attr_reader :status, :operation_id, :body
|
|
10
|
+
|
|
11
|
+
def initialize(message, status: nil, operation_id: nil, body: nil)
|
|
12
|
+
super(message)
|
|
13
|
+
@status, @operation_id, @body = status, operation_id, body
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
class ClientError < Error; end
|
|
17
|
+
class ServerError < Error; end
|
|
18
|
+
class NetworkError < Error; end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
OPERATIONS = JSON.parse(<<~'JSON').freeze
|
|
22
|
+
{"spotify-album": {"bodyParam": null, "bodyRequired": false, "id": "spotify-album", "method": "GET", "params": [{"description": "Spotify album URI or open.spotify.com album URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:album:4aawyAB9vmqN3uQ7FjRGTy"}, {"description": "Spotify album ID", "in": "query", "name": "id", "type": "string", "x-example": "4aawyAB9vmqN3uQ7FjRGTy"}, {"description": "Track offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Track limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 50}], "path": "/spotify/album", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-album-tracks": {"bodyParam": null, "bodyRequired": false, "id": "spotify-album-tracks", "method": "GET", "params": [{"description": "Spotify album URI or open.spotify.com album URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:album:4aawyAB9vmqN3uQ7FjRGTy"}, {"description": "Spotify album ID", "in": "query", "name": "id", "type": "string", "x-example": "4aawyAB9vmqN3uQ7FjRGTy"}, {"description": "Track offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Track limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 50}], "path": "/spotify/album/tracks", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-albums-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-albums-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Album result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 30}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 20}, {"description": "Include audiobook context where available", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/albums/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-artist": {"bodyParam": null, "bodyRequired": false, "id": "spotify-artist", "method": "GET", "params": [{"description": "Spotify artist URI or open.spotify.com artist URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:artist:0TnOYISbd1XYRBk9myaseg"}, {"description": "Spotify artist ID", "in": "query", "name": "id", "type": "string", "x-example": "0TnOYISbd1XYRBk9myaseg"}], "path": "/spotify/artist", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-artist-albums": {"bodyParam": null, "bodyRequired": false, "id": "spotify-artist-albums", "method": "GET", "params": [{"description": "Spotify artist URI or open.spotify.com artist URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:artist:0TnOYISbd1XYRBk9myaseg"}, {"description": "Spotify artist ID", "in": "query", "name": "id", "type": "string", "x-example": "0TnOYISbd1XYRBk9myaseg"}, {"description": "album, single, compilation, appears_on, or all", "enum": ["album", "single", "compilation", "appears_on", "all"], "in": "query", "name": "type", "type": "string", "x-example": "album"}, {"description": "date_desc, date_asc, name_asc, or name_desc", "enum": ["date_desc", "date_asc", "name_asc", "name_desc"], "in": "query", "name": "order", "type": "string", "x-example": "date_desc"}, {"description": "Offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 50}], "path": "/spotify/artist/albums", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"enum": ["album", "single", "compilation", "appears_on", "all"], "in": "query", "name": "type", "type": "string"}, {"enum": ["date_desc", "date_asc", "name_asc", "name_desc"], "in": "query", "name": "order", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-artist-playlists": {"bodyParam": null, "bodyRequired": false, "id": "spotify-artist-playlists", "method": "GET", "params": [{"description": "Spotify artist URI or open.spotify.com artist URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:artist:0TnOYISbd1XYRBk9myaseg"}, {"description": "Spotify artist ID", "in": "query", "name": "id", "type": "string", "x-example": "0TnOYISbd1XYRBk9myaseg"}], "path": "/spotify/artist/playlists", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-artist-related": {"bodyParam": null, "bodyRequired": false, "id": "spotify-artist-related", "method": "GET", "params": [{"description": "Spotify artist URI or open.spotify.com artist URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:artist:0TnOYISbd1XYRBk9myaseg"}, {"description": "Spotify artist ID", "in": "query", "name": "id", "type": "string", "x-example": "0TnOYISbd1XYRBk9myaseg"}], "path": "/spotify/artist/related", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-artists-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-artists-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 20}], "path": "/spotify/artists/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-audiobook": {"bodyParam": null, "bodyRequired": false, "id": "spotify-audiobook", "method": "GET", "params": [{"description": "Spotify audiobook/show URI or open.spotify.com show URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:show:76GTo4lM62dFR11VuALF01"}, {"description": "Spotify show ID", "in": "query", "name": "id", "type": "string", "x-example": "76GTo4lM62dFR11VuALF01"}], "path": "/spotify/audiobook", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-audiobook-chapters": {"bodyParam": null, "bodyRequired": false, "id": "spotify-audiobook-chapters", "method": "GET", "params": [{"description": "Spotify audiobook/show URI or open.spotify.com show URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:show:76GTo4lM62dFR11VuALF01"}, {"description": "Spotify show ID", "in": "query", "name": "id", "type": "string", "x-example": "76GTo4lM62dFR11VuALF01"}, {"description": "Chapter offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Chapter limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 10}], "path": "/spotify/audiobook/chapters", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-audiobooks-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-audiobooks-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Audiobook result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 30}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 20}, {"description": "Include audiobook results", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": true}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/audiobooks/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-chapter": {"bodyParam": null, "bodyRequired": false, "id": "spotify-chapter", "method": "GET", "params": [{"description": "Spotify chapter or episode URI/URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:episode:2C2Y5kNq7qCVOVhbA0G3os"}, {"description": "Spotify chapter/episode ID", "in": "query", "name": "id", "type": "string", "x-example": "2C2Y5kNq7qCVOVhbA0G3os"}], "path": "/spotify/chapter", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-episodes-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-episodes-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 20}], "path": "/spotify/episodes/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-featured-charts-by-country": {"bodyParam": null, "bodyRequired": false, "id": "spotify-featured-charts-by-country", "method": "GET", "params": [{"description": "Two-letter Spotify popular-in country code", "in": "query", "name": "country_code", "type": "string", "x-example": "id"}, {"description": "Country hub content ID. Allowed: CHARTS, POPULAR_ALBUMS, POPULAR_ARTISTS, TRENDING_SONGS", "enum": ["CHARTS", "POPULAR_ALBUMS", "POPULAR_ARTISTS", "TRENDING_SONGS"], "in": "query", "name": "content_id", "type": "string", "x-example": "CHARTS"}], "path": "/spotify/featured-charts-by-country", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "country_code", "type": "string"}, {"enum": ["CHARTS", "POPULAR_ALBUMS", "POPULAR_ARTISTS", "TRENDING_SONGS"], "in": "query", "name": "content_id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-genre": {"bodyParam": null, "bodyRequired": false, "id": "spotify-genre", "method": "GET", "params": [{"description": "Spotify genre or page URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:page:0JQ5DAB3zgCauRwnvdEQjJ"}, {"description": "Page pagination offset", "in": "query", "name": "page_offset", "type": "integer", "x-example": 0}, {"description": "Page pagination limit, clamped to 1-50", "in": "query", "name": "page_limit", "type": "integer", "x-example": 10}, {"description": "Section pagination offset", "in": "query", "name": "section_offset", "type": "integer", "x-example": 0}, {"description": "Section pagination limit, clamped to 1-50", "in": "query", "name": "section_limit", "type": "integer", "x-example": 10}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/genre", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "page_offset", "type": "integer"}, {"in": "query", "name": "page_limit", "type": "integer"}, {"in": "query", "name": "section_offset", "type": "integer"}, {"in": "query", "name": "section_limit", "type": "integer"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-home": {"bodyParam": null, "bodyRequired": false, "id": "spotify-home", "method": "GET", "params": [{"description": "IANA time zone used by Spotify home personalization", "in": "query", "name": "time_zone", "type": "string", "x-example": "Asia/Shanghai"}, {"description": "Optional Spotify session token. A random UUID is generated when omitted", "in": "query", "name": "sp_t", "type": "string", "x-example": "00000000-0000-4000-8000-000000000000"}, {"description": "Optional Spotify home facet", "in": "query", "name": "facet", "type": "string", "x-example": ""}, {"description": "Per-section item limit, clamped to 1-50", "in": "query", "name": "section_items_limit", "type": "integer", "x-example": 10}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/home", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "time_zone", "type": "string"}, {"in": "query", "name": "sp_t", "type": "string"}, {"in": "query", "name": "facet", "type": "string"}, {"in": "query", "name": "section_items_limit", "type": "integer"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-playlist": {"bodyParam": null, "bodyRequired": false, "id": "spotify-playlist", "method": "GET", "params": [{"description": "Spotify playlist URI or open.spotify.com playlist URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:playlist:37i9dQZEVXbLwpL8TjsxOG"}, {"description": "Spotify playlist ID. Used when uri is omitted", "in": "query", "name": "id", "type": "string", "x-example": "37i9dQZEVXbLwpL8TjsxOG"}, {"description": "Playlist item offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Playlist item limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 25}, {"description": "Enable watch feed entrypoint", "in": "query", "name": "enable_watch_feed_entrypoint", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/playlist", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "enable_watch_feed_entrypoint", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-playlists-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-playlists-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Playlist result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 30}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 20}, {"description": "Include audiobook context where available", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/playlists/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-categories": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-categories", "method": "GET", "params": [{"description": "Spotify podcast categories page URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:page:0JQ5DArNBzkmxXHCqFLx2U"}, {"description": "Page pagination offset", "in": "query", "name": "page_offset", "type": "integer", "x-example": 0}, {"description": "Page pagination limit, clamped to 1-50", "in": "query", "name": "page_limit", "type": "integer", "x-example": 10}, {"description": "Section pagination offset", "in": "query", "name": "section_offset", "type": "integer", "x-example": 0}, {"description": "Section pagination limit, clamped to 1-50", "in": "query", "name": "section_limit", "type": "integer", "x-example": 10}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify-podcasts/categories", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "page_offset", "type": "integer"}, {"in": "query", "name": "page_limit", "type": "integer"}, {"in": "query", "name": "section_offset", "type": "integer"}, {"in": "query", "name": "section_limit", "type": "integer"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-charts": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-charts", "method": "GET", "params": [{"description": "Chart slug. Allowed: top-podcasts, top-episodes, trending, arts, business, comedy, education, fiction, health-fitness, history, leisure, music, news, religion-spirituality, science, society-culture, sports, technology, true-crime, tv-film", "enum": ["top-podcasts", "top-episodes", "trending", "arts", "business", "comedy", "education", "fiction", "health-fitness", "history", "leisure", "music", "news", "religion-spirituality", "science", "society-culture", "sports", "technology", "true-crime", "tv-film"], "in": "query", "name": "chart", "type": "string", "x-example": "religion-spirituality"}, {"description": "Two-letter region code. Allowed: ar, au, at, br, ca, cl, co, dk, fi, fr, de, in, id, ie, it, jp, mx, nz, no, ph, pl, es, se, nl, gb, us", "enum": ["ar", "au", "at", "br", "ca", "cl", "co", "dk", "fi", "fr", "de", "in", "id", "ie", "it", "jp", "mx", "nz", "no", "ph", "pl", "es", "se", "nl", "gb", "us"], "in": "query", "name": "region", "type": "string", "x-example": "us"}, {"description": "Result limit, clamped to 1-100", "in": "query", "name": "limit", "type": "integer", "x-example": 100}], "path": "/spotify-podcasts/charts", "pathParams": [], "produces": ["application/json"], "queryParams": [{"enum": ["top-podcasts", "top-episodes", "trending", "arts", "business", "comedy", "education", "fiction", "health-fitness", "history", "leisure", "music", "news", "religion-spirituality", "science", "society-culture", "sports", "technology", "true-crime", "tv-film"], "in": "query", "name": "chart", "type": "string"}, {"enum": ["ar", "au", "at", "br", "ca", "cl", "co", "dk", "fi", "fr", "de", "in", "id", "ie", "it", "jp", "mx", "nz", "no", "ph", "pl", "es", "se", "nl", "gb", "us"], "in": "query", "name": "region", "type": "string"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-episode": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-episode", "method": "GET", "params": [{"description": "Spotify episode URI or open.spotify.com episode URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:episode:2C2Y5kNq7qCVOVhbA0G3os"}, {"description": "Spotify episode ID. Used when uri is omitted", "in": "query", "name": "id", "type": "string", "x-example": "2C2Y5kNq7qCVOVhbA0G3os"}], "path": "/spotify-podcasts/episode", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-home": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-home", "method": "GET", "params": [{"description": "Spotify page or genre URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:genre:podcasts-web"}, {"description": "Page pagination offset", "in": "query", "name": "page_offset", "type": "integer", "x-example": 0}, {"description": "Page pagination limit, clamped to 1-50", "in": "query", "name": "page_limit", "type": "integer", "x-example": 10}, {"description": "Section pagination offset", "in": "query", "name": "section_offset", "type": "integer", "x-example": 0}, {"description": "Section pagination limit, clamped to 1-50", "in": "query", "name": "section_limit", "type": "integer", "x-example": 10}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify-podcasts/home", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "page_offset", "type": "integer"}, {"in": "query", "name": "page_limit", "type": "integer"}, {"in": "query", "name": "section_offset", "type": "integer"}, {"in": "query", "name": "section_limit", "type": "integer"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-search", "method": "GET", "params": [{"description": "Podcast search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "chatgpt"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 30}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 20}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include audiobooks", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify-podcasts/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-show": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-show", "method": "GET", "params": [{"description": "Spotify show URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:show:1QQJ7FElLE0K6CIfZNCxU4"}, {"description": "Include content capability trait", "in": "query", "name": "include_content_capability_trait", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify-podcasts/show", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "include_content_capability_trait", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-show-episodes": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-show-episodes", "method": "GET", "params": [{"description": "Spotify show URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:show:1QQJ7FElLE0K6CIfZNCxU4"}, {"description": "Episode offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Episode limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 50}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify-podcasts/show/episodes", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-podcasts-show-recommendations": {"bodyParam": null, "bodyRequired": false, "id": "spotify-podcasts-show-recommendations", "method": "GET", "params": [{"description": "Spotify show URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:show:1QQJ7FElLE0K6CIfZNCxU4"}], "path": "/spotify-podcasts/show/recommendations", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-popular-by-country": {"bodyParam": null, "bodyRequired": false, "id": "spotify-popular-by-country", "method": "GET", "params": [{"description": "Two-letter Spotify popular-in country code", "in": "query", "name": "country_code", "type": "string", "x-example": "us"}], "path": "/spotify/popular-by-country", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "country_code", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-profile": {"bodyParam": null, "bodyRequired": false, "id": "spotify-profile", "method": "GET", "params": [{"description": "Spotify username", "in": "query", "name": "username", "type": "string", "x-example": "spotify"}, {"description": "Spotify user URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:user:spotify"}, {"description": "open.spotify.com user URL", "in": "query", "name": "url", "type": "string", "x-example": "https://open.spotify.com/user/spotify"}, {"description": "Embedded public playlist limit, clamped to 0-50", "in": "query", "name": "playlist_limit", "type": "integer", "x-example": 10}, {"description": "Recently played artist limit, clamped to 0-50", "in": "query", "name": "artist_limit", "type": "integer", "x-example": 10}, {"description": "Embedded episode limit, clamped to 0-50", "in": "query", "name": "episode_limit", "type": "integer", "x-example": 0}], "path": "/spotify/profile", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "username", "type": "string"}, {"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "url", "type": "string"}, {"in": "query", "name": "playlist_limit", "type": "integer"}, {"in": "query", "name": "artist_limit", "type": "integer"}, {"in": "query", "name": "episode_limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-profile-followers": {"bodyParam": null, "bodyRequired": false, "id": "spotify-profile-followers", "method": "GET", "params": [{"description": "Spotify username", "in": "query", "name": "username", "type": "string", "x-example": "spotify"}, {"description": "Spotify user URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:user:spotify"}, {"description": "open.spotify.com user URL", "in": "query", "name": "url", "type": "string", "x-example": "https://open.spotify.com/user/spotify"}, {"description": "Follower offset applied locally", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Follower limit, clamped to 1-200", "in": "query", "name": "limit", "type": "integer", "x-example": 50}], "path": "/spotify/profile/followers", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "username", "type": "string"}, {"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "url", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-profile-playlists": {"bodyParam": null, "bodyRequired": false, "id": "spotify-profile-playlists", "method": "GET", "params": [{"description": "Spotify username", "in": "query", "name": "username", "type": "string", "x-example": "spotify"}, {"description": "Spotify user URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:user:spotify"}, {"description": "open.spotify.com user URL", "in": "query", "name": "url", "type": "string", "x-example": "https://open.spotify.com/user/spotify"}, {"description": "Playlist offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Playlist limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 20}], "path": "/spotify/profile/playlists", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "username", "type": "string"}, {"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "url", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-profiles-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-profiles-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Profile result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 30}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 20}, {"description": "Include audiobook context where available", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/profiles/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Result limit per section, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 10}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 5}, {"description": "Include audiobook results", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include artist concert availability fields", "in": "query", "name": "include_artist_has_concerts_field", "type": "boolean", "x-example": false}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": true}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}, {"description": "Treat the search term as a prefix", "in": "query", "name": "is_prefix", "type": "boolean", "x-example": false}], "path": "/spotify/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_artist_has_concerts_field", "type": "boolean"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}, {"in": "query", "name": "is_prefix", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-section": {"bodyParam": null, "bodyRequired": false, "id": "spotify-section", "method": "GET", "params": [{"description": "Spotify section URI", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:section:0JQ5IMCbQBLqNPkcmYxQPQ"}, {"description": "Section item offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Section item limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 20}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/section", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-shows-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-shows-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 20}], "path": "/spotify/shows/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-track": {"bodyParam": null, "bodyRequired": false, "id": "spotify-track", "method": "GET", "params": [{"description": "Spotify track URI or open.spotify.com track URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:track:4vGg44GdCw3X8i8r01XJH0"}, {"description": "Spotify track ID. Used when uri is omitted", "in": "query", "name": "id", "type": "string", "x-example": "4vGg44GdCw3X8i8r01XJH0"}], "path": "/spotify/track", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}], "security": ["ApiKeyAuth"]}, "spotify-track-recommended": {"bodyParam": null, "bodyRequired": false, "id": "spotify-track-recommended", "method": "GET", "params": [{"description": "Spotify track URI or open.spotify.com track URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:track:4vGg44GdCw3X8i8r01XJH0"}, {"description": "Spotify track ID. Used when uri is omitted", "in": "query", "name": "id", "type": "string", "x-example": "4vGg44GdCw3X8i8r01XJH0"}, {"description": "Recommendation limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 5}], "path": "/spotify/track/recommended", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"in": "query", "name": "limit", "type": "integer"}], "security": ["ApiKeyAuth"]}, "spotify-track-similar-albums": {"bodyParam": null, "bodyRequired": false, "id": "spotify-track-similar-albums", "method": "GET", "params": [{"description": "Spotify track URI or open.spotify.com track URL", "in": "query", "name": "uri", "type": "string", "x-example": "spotify:track:4vGg44GdCw3X8i8r01XJH0"}, {"description": "Spotify track ID. Used when uri is omitted", "in": "query", "name": "id", "type": "string", "x-example": "4vGg44GdCw3X8i8r01XJH0"}, {"description": "Album limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 50}, {"description": "Request albums-only recommendations", "in": "query", "name": "albums_only", "type": "boolean", "x-example": true}], "path": "/spotify/track/similar-albums", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "uri", "type": "string"}, {"in": "query", "name": "id", "type": "string"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "albums_only", "type": "boolean"}], "security": ["ApiKeyAuth"]}, "spotify-tracks-search": {"bodyParam": null, "bodyRequired": false, "id": "spotify-tracks-search", "method": "GET", "params": [{"description": "Search term", "in": "query", "name": "q", "required": true, "type": "string", "x-example": "hello"}, {"description": "Search offset", "in": "query", "name": "offset", "type": "integer", "x-example": 0}, {"description": "Track result limit, clamped to 1-50", "in": "query", "name": "limit", "type": "integer", "x-example": 20}, {"description": "Top result limit, clamped to 1-50", "in": "query", "name": "number_of_top_results", "type": "integer", "x-example": 20}, {"description": "Include audiobook context where available", "in": "query", "name": "include_audiobooks", "type": "boolean", "x-example": true}, {"description": "Include pre-release results", "in": "query", "name": "include_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include album pre-release results", "in": "query", "name": "include_album_pre_releases", "type": "boolean", "x-example": false}, {"description": "Include authors", "in": "query", "name": "include_authors", "type": "boolean", "x-example": false}, {"description": "Include Spotify episode content ratings v2", "in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean", "x-example": false}], "path": "/spotify/tracks/search", "pathParams": [], "produces": ["application/json"], "queryParams": [{"in": "query", "name": "q", "required": true, "type": "string"}, {"in": "query", "name": "offset", "type": "integer"}, {"in": "query", "name": "limit", "type": "integer"}, {"in": "query", "name": "number_of_top_results", "type": "integer"}, {"in": "query", "name": "include_audiobooks", "type": "boolean"}, {"in": "query", "name": "include_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_album_pre_releases", "type": "boolean"}, {"in": "query", "name": "include_authors", "type": "boolean"}, {"in": "query", "name": "include_episode_content_ratings_v2", "type": "boolean"}], "security": ["ApiKeyAuth"]}}
|
|
23
|
+
JSON
|
|
24
|
+
OPERATION_IDS = JSON.parse(<<~'JSON').freeze
|
|
25
|
+
["spotify-album", "spotify-album-tracks", "spotify-albums-search", "spotify-artist", "spotify-artist-albums", "spotify-artist-playlists", "spotify-artist-related", "spotify-artists-search", "spotify-audiobook", "spotify-audiobook-chapters", "spotify-audiobooks-search", "spotify-chapter", "spotify-episodes-search", "spotify-featured-charts-by-country", "spotify-genre", "spotify-home", "spotify-playlist", "spotify-playlists-search", "spotify-podcasts-categories", "spotify-podcasts-charts", "spotify-podcasts-episode", "spotify-podcasts-home", "spotify-podcasts-search", "spotify-podcasts-show", "spotify-podcasts-show-episodes", "spotify-podcasts-show-recommendations", "spotify-popular-by-country", "spotify-profile", "spotify-profile-followers", "spotify-profile-playlists", "spotify-profiles-search", "spotify-search", "spotify-section", "spotify-shows-search", "spotify-track", "spotify-track-recommended", "spotify-track-similar-albums", "spotify-tracks-search"]
|
|
26
|
+
JSON
|
|
27
|
+
OPERATION_COUNT = OPERATION_IDS.length
|
|
28
|
+
|
|
29
|
+
class Client
|
|
30
|
+
attr_reader :base_url
|
|
31
|
+
|
|
32
|
+
def initialize(api_key: ENV["CRAWLORA_API_KEY"], base_url: "https://api.crawlora.net/api/v1", timeout: 30, user_agent: "crawlora-spotify-ruby/0.1.0", transport: nil)
|
|
33
|
+
@api_key = api_key
|
|
34
|
+
@base_url = base_url.to_s.sub(%r{/+$}, "")
|
|
35
|
+
@timeout = Float(timeout)
|
|
36
|
+
@user_agent = user_agent
|
|
37
|
+
@transport = transport
|
|
38
|
+
@closed = false
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def request(operation_id, params = {}, response_type: :auto)
|
|
42
|
+
raise Errors::ClientError, "client is closed" if @closed
|
|
43
|
+
operation_id = operation_id.to_s
|
|
44
|
+
operation = OPERATIONS[operation_id]
|
|
45
|
+
raise Errors::ClientError.new("unknown operation: #{operation_id}", operation_id: operation_id) unless operation
|
|
46
|
+
raise Errors::ClientError.new("Crawlora API key is required", operation_id: operation_id) if @api_key.nil? || @api_key.to_s.empty?
|
|
47
|
+
normalized = params.each_with_object({}) { |(key, value), out| out[key.to_s] = value }
|
|
48
|
+
payload = request_body(operation, normalized)
|
|
49
|
+
url = build_url(operation, normalized)
|
|
50
|
+
uri = URI.parse(url)
|
|
51
|
+
request = operation["method"] == "POST" ? Net::HTTP::Post.new(uri) : Net::HTTP::Get.new(uri)
|
|
52
|
+
unless payload.nil?
|
|
53
|
+
request.body = payload
|
|
54
|
+
request["Content-Type"] = "application/json"
|
|
55
|
+
end
|
|
56
|
+
request["x-api-key"] = @api_key
|
|
57
|
+
request["User-Agent"] = @user_agent
|
|
58
|
+
request["Accept"] = operation["produces"].include?("text/plain") ? "application/json, text/plain" : "application/json"
|
|
59
|
+
begin
|
|
60
|
+
if @transport
|
|
61
|
+
response = if operation["method"] == "POST"
|
|
62
|
+
@transport.call(url, request.to_hash, @timeout, "POST", payload)
|
|
63
|
+
else
|
|
64
|
+
@transport.call(url, request.to_hash, @timeout)
|
|
65
|
+
end
|
|
66
|
+
status = Integer(response.fetch(:status) { response.fetch("status") })
|
|
67
|
+
body = response.fetch(:body) { response.fetch("body", "") }
|
|
68
|
+
headers = response.fetch(:headers) { response.fetch("headers", {}) }
|
|
69
|
+
content_type = headers["content-type"] || headers["Content-Type"]
|
|
70
|
+
else
|
|
71
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
72
|
+
http.use_ssl = uri.scheme == "https"
|
|
73
|
+
http.open_timeout = @timeout
|
|
74
|
+
http.read_timeout = @timeout
|
|
75
|
+
response = http.start { |connection| connection.request(request) }
|
|
76
|
+
status = response.code.to_i
|
|
77
|
+
body = response.body
|
|
78
|
+
content_type = response["content-type"]
|
|
79
|
+
end
|
|
80
|
+
rescue Timeout::Error, SocketError, SystemCallError, IOError, EOFError, Net::HTTPBadResponse, Net::ProtocolError, OpenSSL::SSL::SSLError => error
|
|
81
|
+
raise Errors::NetworkError.new("Crawlora request failed: #{error.message}", operation_id: operation_id)
|
|
82
|
+
end
|
|
83
|
+
unless status >= 200 && status < 300
|
|
84
|
+
klass = status >= 500 ? Errors::ServerError : Errors::ClientError
|
|
85
|
+
raise klass.new("Crawlora returned HTTP #{status}", status: status, operation_id: operation_id, body: body)
|
|
86
|
+
end
|
|
87
|
+
parse_response(body, content_type, operation, normalized, response_type)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def close
|
|
91
|
+
@closed = true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def closed?
|
|
95
|
+
@closed
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def with
|
|
99
|
+
return self unless block_given?
|
|
100
|
+
yield self
|
|
101
|
+
ensure
|
|
102
|
+
close if block_given?
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def self.operation_count
|
|
106
|
+
OPERATION_COUNT
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def self.operation_ids
|
|
110
|
+
OPERATION_IDS
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def self.operations
|
|
114
|
+
OPERATIONS
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
define_method('podcasts_categories') do |**params|
|
|
118
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
119
|
+
request('spotify-podcasts-categories', params, response_type: response_type)
|
|
120
|
+
end
|
|
121
|
+
define_method('podcasts_charts') do |**params|
|
|
122
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
123
|
+
request('spotify-podcasts-charts', params, response_type: response_type)
|
|
124
|
+
end
|
|
125
|
+
define_method('podcasts_episode') do |**params|
|
|
126
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
127
|
+
request('spotify-podcasts-episode', params, response_type: response_type)
|
|
128
|
+
end
|
|
129
|
+
define_method('podcasts_home') do |**params|
|
|
130
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
131
|
+
request('spotify-podcasts-home', params, response_type: response_type)
|
|
132
|
+
end
|
|
133
|
+
define_method('podcasts_search') do |**params|
|
|
134
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
135
|
+
request('spotify-podcasts-search', params, response_type: response_type)
|
|
136
|
+
end
|
|
137
|
+
define_method('podcasts_show') do |**params|
|
|
138
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
139
|
+
request('spotify-podcasts-show', params, response_type: response_type)
|
|
140
|
+
end
|
|
141
|
+
define_method('podcasts_show_episodes') do |**params|
|
|
142
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
143
|
+
request('spotify-podcasts-show-episodes', params, response_type: response_type)
|
|
144
|
+
end
|
|
145
|
+
define_method('podcasts_show_recommendations') do |**params|
|
|
146
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
147
|
+
request('spotify-podcasts-show-recommendations', params, response_type: response_type)
|
|
148
|
+
end
|
|
149
|
+
define_method('album') do |**params|
|
|
150
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
151
|
+
request('spotify-album', params, response_type: response_type)
|
|
152
|
+
end
|
|
153
|
+
define_method('album_tracks') do |**params|
|
|
154
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
155
|
+
request('spotify-album-tracks', params, response_type: response_type)
|
|
156
|
+
end
|
|
157
|
+
define_method('albums_search') do |**params|
|
|
158
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
159
|
+
request('spotify-albums-search', params, response_type: response_type)
|
|
160
|
+
end
|
|
161
|
+
define_method('artist') do |**params|
|
|
162
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
163
|
+
request('spotify-artist', params, response_type: response_type)
|
|
164
|
+
end
|
|
165
|
+
define_method('artist_albums') do |**params|
|
|
166
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
167
|
+
request('spotify-artist-albums', params, response_type: response_type)
|
|
168
|
+
end
|
|
169
|
+
define_method('artist_playlists') do |**params|
|
|
170
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
171
|
+
request('spotify-artist-playlists', params, response_type: response_type)
|
|
172
|
+
end
|
|
173
|
+
define_method('artist_related') do |**params|
|
|
174
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
175
|
+
request('spotify-artist-related', params, response_type: response_type)
|
|
176
|
+
end
|
|
177
|
+
define_method('artists_search') do |**params|
|
|
178
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
179
|
+
request('spotify-artists-search', params, response_type: response_type)
|
|
180
|
+
end
|
|
181
|
+
define_method('audiobook') do |**params|
|
|
182
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
183
|
+
request('spotify-audiobook', params, response_type: response_type)
|
|
184
|
+
end
|
|
185
|
+
define_method('audiobook_chapters') do |**params|
|
|
186
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
187
|
+
request('spotify-audiobook-chapters', params, response_type: response_type)
|
|
188
|
+
end
|
|
189
|
+
define_method('audiobooks_search') do |**params|
|
|
190
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
191
|
+
request('spotify-audiobooks-search', params, response_type: response_type)
|
|
192
|
+
end
|
|
193
|
+
define_method('chapter') do |**params|
|
|
194
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
195
|
+
request('spotify-chapter', params, response_type: response_type)
|
|
196
|
+
end
|
|
197
|
+
define_method('episodes_search') do |**params|
|
|
198
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
199
|
+
request('spotify-episodes-search', params, response_type: response_type)
|
|
200
|
+
end
|
|
201
|
+
define_method('featured_charts_by_country') do |**params|
|
|
202
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
203
|
+
request('spotify-featured-charts-by-country', params, response_type: response_type)
|
|
204
|
+
end
|
|
205
|
+
define_method('genre') do |**params|
|
|
206
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
207
|
+
request('spotify-genre', params, response_type: response_type)
|
|
208
|
+
end
|
|
209
|
+
define_method('home') do |**params|
|
|
210
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
211
|
+
request('spotify-home', params, response_type: response_type)
|
|
212
|
+
end
|
|
213
|
+
define_method('playlist') do |**params|
|
|
214
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
215
|
+
request('spotify-playlist', params, response_type: response_type)
|
|
216
|
+
end
|
|
217
|
+
define_method('playlists_search') do |**params|
|
|
218
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
219
|
+
request('spotify-playlists-search', params, response_type: response_type)
|
|
220
|
+
end
|
|
221
|
+
define_method('popular_by_country') do |**params|
|
|
222
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
223
|
+
request('spotify-popular-by-country', params, response_type: response_type)
|
|
224
|
+
end
|
|
225
|
+
define_method('profile') do |**params|
|
|
226
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
227
|
+
request('spotify-profile', params, response_type: response_type)
|
|
228
|
+
end
|
|
229
|
+
define_method('profile_followers') do |**params|
|
|
230
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
231
|
+
request('spotify-profile-followers', params, response_type: response_type)
|
|
232
|
+
end
|
|
233
|
+
define_method('profile_playlists') do |**params|
|
|
234
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
235
|
+
request('spotify-profile-playlists', params, response_type: response_type)
|
|
236
|
+
end
|
|
237
|
+
define_method('profiles_search') do |**params|
|
|
238
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
239
|
+
request('spotify-profiles-search', params, response_type: response_type)
|
|
240
|
+
end
|
|
241
|
+
define_method('search') do |**params|
|
|
242
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
243
|
+
request('spotify-search', params, response_type: response_type)
|
|
244
|
+
end
|
|
245
|
+
define_method('section') do |**params|
|
|
246
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
247
|
+
request('spotify-section', params, response_type: response_type)
|
|
248
|
+
end
|
|
249
|
+
define_method('shows_search') do |**params|
|
|
250
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
251
|
+
request('spotify-shows-search', params, response_type: response_type)
|
|
252
|
+
end
|
|
253
|
+
define_method('track') do |**params|
|
|
254
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
255
|
+
request('spotify-track', params, response_type: response_type)
|
|
256
|
+
end
|
|
257
|
+
define_method('track_recommended') do |**params|
|
|
258
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
259
|
+
request('spotify-track-recommended', params, response_type: response_type)
|
|
260
|
+
end
|
|
261
|
+
define_method('track_similar_albums') do |**params|
|
|
262
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
263
|
+
request('spotify-track-similar-albums', params, response_type: response_type)
|
|
264
|
+
end
|
|
265
|
+
define_method('tracks_search') do |**params|
|
|
266
|
+
response_type = params.delete(:response_type) || params.delete(:_response_type) || :auto
|
|
267
|
+
request('spotify-tracks-search', params, response_type: response_type)
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
private
|
|
271
|
+
|
|
272
|
+
# POST operations take their JSON body under the body parameter name or "body".
|
|
273
|
+
def request_body(operation, params)
|
|
274
|
+
name = operation["bodyParam"]
|
|
275
|
+
return nil if name.nil?
|
|
276
|
+
value = params.key?(name) ? params[name] : params["body"]
|
|
277
|
+
if value.nil?
|
|
278
|
+
raise Errors::ClientError.new("missing request body: #{name}", operation_id: operation["id"]) if operation["bodyRequired"]
|
|
279
|
+
return nil
|
|
280
|
+
end
|
|
281
|
+
value.is_a?(String) ? value : JSON.generate(value)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def build_url(operation, params)
|
|
285
|
+
known = operation["params"].map { |param| param["name"] }
|
|
286
|
+
known << "body" if operation["bodyParam"]
|
|
287
|
+
unknown = params.keys - known
|
|
288
|
+
raise Errors::ClientError.new("unknown parameters: #{unknown.join(', ')}", operation_id: operation["id"]) unless unknown.empty?
|
|
289
|
+
path = operation["path"].dup
|
|
290
|
+
operation["params"].select { |param| param["in"] == "path" }.each do |param|
|
|
291
|
+
value = params[param["name"]]
|
|
292
|
+
raise Errors::ClientError.new("missing path parameter: #{param['name']}", operation_id: operation["id"]) if value.nil?
|
|
293
|
+
path.sub!("{" + param["name"] + "}", percent_encode(value.to_s))
|
|
294
|
+
end
|
|
295
|
+
pairs = []
|
|
296
|
+
operation["queryParams"].each do |param|
|
|
297
|
+
name = param["name"]
|
|
298
|
+
value = params.key?(name) ? params[name] : param["default"]
|
|
299
|
+
if value.nil?
|
|
300
|
+
raise Errors::ClientError.new("missing query parameter: #{name}", operation_id: operation["id"]) if param["required"]
|
|
301
|
+
next
|
|
302
|
+
end
|
|
303
|
+
enum_values = param["enum"] || (param["items"] && param["items"]["enum"])
|
|
304
|
+
if enum_values && !(value.is_a?(Array) ? value : [value]).all? { |item| enum_values.map(&:to_s).include?(item.to_s) }
|
|
305
|
+
raise Errors::ClientError.new("invalid value for #{name}", operation_id: operation["id"])
|
|
306
|
+
end
|
|
307
|
+
if value.is_a?(Array)
|
|
308
|
+
format = param["collectionFormat"] || "csv"
|
|
309
|
+
if format == "multi"
|
|
310
|
+
value.each { |item| pairs << [name, scalar(item)] }
|
|
311
|
+
else
|
|
312
|
+
separator = {"csv" => ",", "ssv" => " ", "tsv" => "\t", "pipes" => "|"}[format] || ","
|
|
313
|
+
pairs << [name, value.map { |item| scalar(item) }.join(separator)]
|
|
314
|
+
end
|
|
315
|
+
else
|
|
316
|
+
pairs << [name, scalar(value)]
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
query = pairs.map { |name, value| "#{percent_encode(name)}=#{percent_encode(value)}" }.join("&")
|
|
320
|
+
@base_url + path + (query.empty? ? "" : "?" + query)
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def scalar(value)
|
|
324
|
+
value == true ? "true" : (value == false ? "false" : value.to_s)
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
def percent_encode(value)
|
|
328
|
+
URI::DEFAULT_PARSER.escape(value.to_s, /[^A-Za-z0-9\-._~]/)
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def parse_response(body, content_type, operation, params, response_type)
|
|
332
|
+
type = response_type.to_s
|
|
333
|
+
raise Errors::ClientError.new("response_type must be auto, json, or text", operation_id: operation["id"]) unless %w[auto json text].include?(type)
|
|
334
|
+
format = operation["params"].find { |param| param["name"] == "format" }
|
|
335
|
+
text_formats = format && format["enum"] ? format["enum"].reject { |value| %w[json application/json].include?(value.to_s.downcase) } : []
|
|
336
|
+
raw_format = params["format"] && text_formats.include?(params["format"].to_s)
|
|
337
|
+
json_format = format && format["enum"] && format["enum"].any? { |value| %w[json application/json].include?(value.to_s.downcase) } && %w[json application/json].include?(params["format"].to_s.downcase)
|
|
338
|
+
is_json = json_format || content_type.to_s.downcase.include?("json") || operation["produces"] == ["application/json"]
|
|
339
|
+
return body if type == "text" || raw_format || (type == "auto" && !is_json)
|
|
340
|
+
JSON.parse(body)
|
|
341
|
+
rescue JSON::ParserError => error
|
|
342
|
+
raise Errors::Error.new("invalid JSON response from Crawlora: #{error.message}", operation_id: operation["id"], body: body)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
public
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: crawlora-spotify
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Crawlora
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2026-10-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Credential-free Spotify API access through Crawlora's hosted service.
|
|
14
|
+
email:
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- CHANGELOG.md
|
|
20
|
+
- LICENSE
|
|
21
|
+
- README.md
|
|
22
|
+
- lib/crawlora/spotify.rb
|
|
23
|
+
- lib/crawlora/spotify/client.rb
|
|
24
|
+
- lib/crawlora/spotify/version.rb
|
|
25
|
+
homepage: https://crawlora.net/?utm_source=rubygems&utm_medium=referral&utm_campaign=platform-clients&utm_content=spotify-ruby-homepage
|
|
26
|
+
licenses:
|
|
27
|
+
- MIT
|
|
28
|
+
metadata:
|
|
29
|
+
source_code_uri: https://github.com/Crawlora-org/crawlora-spotify
|
|
30
|
+
documentation_uri: https://github.com/Crawlora-org/crawlora-spotify/blob/main/ruby/README.md
|
|
31
|
+
rubygems_mfa_required: 'true'
|
|
32
|
+
post_install_message:
|
|
33
|
+
rdoc_options: []
|
|
34
|
+
require_paths:
|
|
35
|
+
- lib
|
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2.6'
|
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - ">="
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
46
|
+
requirements: []
|
|
47
|
+
rubygems_version: 3.4.19
|
|
48
|
+
signing_key:
|
|
49
|
+
specification_version: 4
|
|
50
|
+
summary: Spotify client for the Crawlora hosted API
|
|
51
|
+
test_files: []
|