Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qobuz: API returns 404 when release is available #335

Closed
ROpdebee opened this issue Dec 22, 2021 · 8 comments · Fixed by #383
Closed

Qobuz: API returns 404 when release is available #335

ROpdebee opened this issue Dec 22, 2021 · 8 comments · Fixed by #383
Assignees
Labels

Comments

@ROpdebee
Copy link
Owner

Even before the script supported Qobuz I noticed that for a few releases the API returns 404 even though the release is still visible in the shop at least in the linked locale.
Another fresh example from the forum

https://community.metabrainz.org/t/ropdebees-userscripts-support-thread/551947/44?u=ropdebee

I should at least investigate and see if I can figure something out, perhaps do a workaround in case it's frequent. IIRC we don't strictly need the Qobuz API except for goodies, and we still have the ID-based cover URL constructor from the original implementation, so we may as well put it to use. Or perhaps we're already using it as a backup, I can't remember 🙂

@tigerman325
Copy link

Is this related? I just tried to grab the image from the following Qobuz release. It returns "Failed to grab images: Failed to construct 'URL': Invalid URL" even though it's a valid URL & I was able to just right click on Qobuz page and grab via image URL that way. However, this release also has a booklet I was hoping to grab. Maybe that's causing the issue? See if we can get the booklet: https://www.qobuz.com/us-en/album/the-endless-river-pink-floyd/fy3ginyk9q1wa. Release: https://musicbrainz.org/release/dfcd5b88-a028-49e0-bc2a-08fbb866c97b/add-cover-art

@ROpdebee
Copy link
Owner Author

The API returns a 404 for me for that release, so it might be related. Unsure why it complains of a broken URL though… Does it "work" with the newest version? It might have something to do with the availability of streaming in different regions, since https://open.qobuz.com/album/fy3ginyk9q1wa redirects to the home page for me (because the API returns a 404).

@kellnerd
Copy link
Collaborator

kellnerd commented Jan 24, 2022

Failed to grab images: URL constructor: null is not a valid URL.

... is the error message I get using both v2022.1.2 and v2022.1.24. It happens during the goodie extraction:

The extracted goodie seems to be the video, not the booklet:

{
  "id": 111507,
  "file_format_id": 52,
  "name": "Clip vidéo",
  "description": "Anisina",
  "url": null,
  "original_url": null
}

@ROpdebee
Copy link
Owner Author

@kellnerd does the open.qobuz.com link work for you? I VPN'ed to the US and now it loads (but for some reason the script still doesn't want to load the release, perhaps because of some caching)

@kellnerd
Copy link
Collaborator

does the open.qobuz.com link work for you?

Nope, it also redirects me to the home page.

@ROpdebee
Copy link
Owner Author

OK, the goodies in the response include video clips which don't have a URL, so those need to be filtered out:

[
  {
    "id": 111507,
    "file_format_id": 52,
    "name": "Clip vidéo",
    "description": "Anisina",
    "url": null,
    "original_url": null
  },
  {
    "id": 111508,
    "file_format_id": 52,
    "name": "Clip vidéo",
    "description": "Untitled",
    "url": null,
    "original_url": null
  },
  {
    "id": 111509,
    "file_format_id": 52,
    "name": "Clip vidéo",
    "description": "Evrika (A)",
    "url": null,
    "original_url": null
  },
  {
    "id": 111510,
    "file_format_id": 52,
    "name": "Clip vidéo",
    "description": "Nervana",
    "url": null,
    "original_url": null
  },
  {
    "id": 111511,
    "file_format_id": 52,
    "name": "Clip vidéo",
    "description": "Allons-y",
    "url": null,
    "original_url": null
  },
  {
    "id": 111512,
    "file_format_id": 52,
    "name": "Clip vidéo",
    "description": "Evrika (B)",
    "url": null,
    "original_url": null
  },
  {
    "id": 111513,
    "file_format_id": 21,
    "name": "Livret Numérique",
    "description": "Pink Floyd - The Endless River",
    "url": "https://static.qobuz.com/goodies/31/000111513.pdf",
    "original_url": "https://static.qobuz.com/goodies/31/000111513.pdf"
  }
]

@ROpdebee
Copy link
Owner Author

On the topic of API 404s, it appears Qobuz is using the IP address of the requester to figure out their location, and returns a 404 if the album is not available in their location. The release posted above is available in the US, and with a US IP, the API will return the requested information. However, it's not available in Europe (https://www.qobuz.com/be-nl/album/the-endless-river-pink-floyd/fy3ginyk9q1wa is 404), and from a European IP, the API returns 404. It doesn't look like you can convince the Qobuz API that you're in a different country, except for using a proxy or VPN. The European release has a different ID (https://www.qobuz.com/be-nl/album/the-endless-river-pink-floyd/0825646184729). The API does work for this release in Europe, but not in the US.

@tigerman325
Copy link

It works now!! Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants