[WIP] Spotify artist URI to social pages, Wiki summary
Since seeing this feature on the roadmap, I thought I'd get the initial architecture in place to make sure this might be the best/most effective string of API calls to make.
Right now it takes two calls to reach social links, four to reach a Wiki summary:
- MusicBrainz url lookup:
- Takes Spotify artist URL
- Returns MusicBrains ID
- MusicBrainz artist social links:
- Takes MusicBrainz ID
- Returns social links (ie. Wikidata, YouTube, SoundCloud, Facebook, Discogs, official pages, etc.)
- Wikidata to Wikipedia page:
- Takes Wikidata ID
- Returns Wikipedia pages by language
- Fetch summary:
- Takes Wikipedia page
- Returns summary of artist page
I feel like it should be possible to reach the MusicBrainz social links with one call, but their API docs are a bit of a mess. The total call time with reqwests is around 3-4s.
How are you getting the musicbrainz ID from a Spotify URL? Is there some API to do that that I've missed?
How are you getting the musicbrainz ID from a Spotify URL? Is there some API to do that that I've missed?
The MusicBrainz ID is retrieved by looking up which artist has the Spotify URL in their metadata on MusicBrainz.
For example: https://beta.musicbrainz.org/ws/2/url/?query=url:https://open.spotify.com/artist/1WZarnZpWEv7dDtjAETt4X
Excellent, thank you!
That sounds great @jacksongoode!
A proof of concept using ureq can be checked out here. First time working with Rust so it might take me a while to integrate :)
For example: https://beta.musicbrainz.org/ws/2/url/?query=url:https://open.spotify.com/artist/1WZarnZpWEv7dDtjAETt4X
Not sure if important but the URI without the subdomain of beta. produces the same XML data
https://musicbrainz.org/ws/2/url/?query=url:https://open.spotify.com/artist/1WZarnZpWEv7dDtjAETt4X
non-beta URI I feel is potentially more future stable