jamendo: send a User-Agent (Jamendo returns empty results without one)
Jamendo API v3.0 answers HTTP 200 success with an empty result set to any request that carries no User-Agent header. reqwest sends none by default, so every search/detail/stream call came back empty and tracks would not resolve or play (jamendo resource not found). Set a UA on the JamApi client, like the SoundCloud provider does. Live-verified against the API: search, track detail, and stream-URL resolution all return data with the header present. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
06381949ab
commit
7df5f0a1c2
|
|
@ -55,6 +55,11 @@ Objects (fields we read):
|
||||||
- **album**: `id`, `name`, `artist_name`; `/albums/tracks` returns the album
|
- **album**: `id`, `name`, `artist_name`; `/albums/tracks` returns the album
|
||||||
wrapping a `tracks[]` array of the same track shape.
|
wrapping a `tracks[]` array of the same track shape.
|
||||||
|
|
||||||
|
**A `User-Agent` header is mandatory** (live-discovered 2026-07-24): Jamendo's
|
||||||
|
API returns HTTP 200 `success` with an **empty** result set to any request that
|
||||||
|
carries none — and `reqwest` sends none by default — so `JamApi` sets one. This
|
||||||
|
is silent (no error), so a missing UA looks exactly like "no matches".
|
||||||
|
|
||||||
Search parameters: `search` (free text across track/album/artist/tags),
|
Search parameters: `search` (free text across track/album/artist/tags),
|
||||||
`namesearch` (name match), `tags` (AND) / `fuzzytags` (fuzzy OR),
|
`namesearch` (name match), `tags` (AND) / `fuzzytags` (fuzzy OR),
|
||||||
`order` (relevance, popularity, downloads, listens, releasedate, …). v1 uses
|
`order` (relevance, popularity, downloads, listens, releasedate, …). v1 uses
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,10 @@ impl JamApi {
|
||||||
) -> Result<Self, FetchError> {
|
) -> Result<Self, FetchError> {
|
||||||
let http = reqwest::Client::builder()
|
let http = reqwest::Client::builder()
|
||||||
.timeout(timeout)
|
.timeout(timeout)
|
||||||
|
// Jamendo's API silently returns HTTP 200 with an empty result set
|
||||||
|
// (results_count: 0) to requests that carry no User-Agent — reqwest
|
||||||
|
// sends none by default — so a UA is mandatory, not cosmetic.
|
||||||
|
.user_agent(concat!("Mozilla/5.0 crabidy/", env!("CARGO_PKG_VERSION")))
|
||||||
.build()
|
.build()
|
||||||
.map_err(|err| FetchError::Http(err.to_string()))?;
|
.map_err(|err| FetchError::Http(err.to_string()))?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue