Hi all,
I’m using MSXML2 with the json format to retrieve information from MusicBrainz.
That woks fine.
Now I would like to retrieve album cover art.
I understood that this has to be fetched via archive.org using the MBID, but I didn’t understand how this exactly works.
Can somebody post any example URL for me?
I tried (for example) this:
The result is an html page and I don’t know how to retrieve the jpg.
Entering the redirected path in a firefox browser, I retrieve the JSON Information I want to get.
Retrieving the exact same URL via MSXML2 leads to an “access denied” error - and the MSXML2 Code itself works fine…
Any clue why this might happen or what the reason for the redirection is?
–Ulrich
I don’t know MSXML2. A quick Google search shows it is some XML processing library. Not quite sure why you need this, maybe use some dedicated HTTP request library instead.
But does MSXML2 follow the redirect properly? Can you share the full HTTP response you get? That might contain some details on why your request is failing.
Also set a proper “User-Agent” header with a meaningful user agent. The library by default will most likely set a generic User-Agent instead, maybe that gets blocked.
You could also check with curl if fetching the URL and doing the redirects works in general:
The first Part of the URL is allways different when redirected!
So, do you have any idea how to change the URL (A or C) you’ve given me in a way that I can retrieve JSON readable information from it?
Yes, you can’t use the second URL and replace the IDs. The only proper API request is using https://coverartarchive.org/release/{RELEASE_MBID}
What you describe is indicating that the HTTP library is not following the redirect automatically. You either need to check whether the library supports automatic redirect following (not all do) and set it up accordingly, or you need to implement redirect handling yourself by checking the HTTP status code and Location header of the intial response. Basically the first response returns one of the 3xx redirect status code (302 probably, but you need 5o check) and a Location header with the new URL. Redo a request against this URL.
You might also check whether a different HTTP library works better for you. I haven’t used .Net for years, though, and can’t really give recommendations.