User script to load artist data from wikipedia

Tags: #<Tag:0x00007f05093a73b0> #<Tag:0x00007f05093a7270>


I realized recently that most of the information I add on new or existing artists (birth date/place, links to other databases, ISNI code, etc.) actually already exist on wikipedia and could be imported automatically.

Therefore I wrote a Greasemonkey for that and I would be glad to receive some feedback.

MusicBrainz: Fill artist info from wikidata

Script on Greasyfork

Description: adding a wikidata link on the “create artist” page automatically downloads available data from wikidata and fills the correct fields

Example: if I wanted to add to musicbrainz, I would need to find the wikidata entry address (available from the left side column, Tools > “Wikidata item”), i.e., and copy this address as an external link in the “Add artist” page in musicbrainz:

All the other fields on this screenshot were filled automatically from wikidata.

(NB: if a musicbrainz link already exists in wikidata, the script will tell you so that you don’t create an artist already existing; that would be the case here)

The script can also be called on an existing artist and will:

  • add missing fields
  • warn you if wikipedia has a different value for existing fields

This behavior I didn’t test too much. In particular I’m not sure the difference between preexisting info and what the script changes is clear enough.


Let me know if this script is useful to someone.

I would like to have some feedback (here or on #musicbrainz channel in IRC), e.g.

  • Are there fields you would like to see added? (artist aliases?)
  • Are there other entities (works, releases) you think would benefit from this kind of script?

And of course please report any bug you can find :slight_smile: (I’m sure there are)

[Edit: replaced some “wikipedia” by “wikidata” :)]

New MusicBrainz user scripts
Quickest way to enter multiple new artists?

I can see how this is useful, but I also see it as dangerous. People already copy links without looking at them (such as old-style Discogs URLs); this script makes that even easier, and even more likely to happen. Do you add a hint about the script in the edit note? Another important safeguard would be to check if there already is a MusicBrainz artist ID property on the relevant Wikidata entry – in that case, the user is trying to add a duplicate.

And one minor thing: Wikidata and Wikipedia are different projects. Most of the time when you say “Wikipedia” above, you mean “Wikidata”. Just imagine someone mixing up MusicBrainz and ListenBrainz like that. :slight_smile:



I absolutely agree about the dangerous side when modifying an existing entry… I could probably disable editing existing fields and only add missing ones

Yep, the edit note is prefilled with something like ‘GM script: “MusicBrainz: Fill artist info from wikidata” (2016.4.25)’

The script does that, with a popup “An artist already exists linked to this wikidata id, click “ok” to redirect to their page [ok/cancel]”

I didn’t want to go into detail about that :slight_smile:
I wanted to mention Wikipedia for people who don’t know about Wikidata


I can confirm that in works in Firefox. There is just one thing I disagree about, which is that the script automatically fills in a disambiguation comment too. I wouldn’t recommend adding disambiguations unless there is already an artist with the same name, because it creates so much clutter to the interface.


That’s a good point. I’m not 100% with “only if there already is an artist” (I would rather say “only if it is likely there will be confusion”, e.g. with a common name), but a disambiguation comment shouldn’t be added by default.


Just to confuse things…
I’m happy with there always being a disambiguation, as long as it’s tidy, as I find a scattering of releases with a disambiguation in the UI just as (if not more so) confusing than having all of them with one. As well as practical considerations (a disambiguation is much more useful before all the artists are lumped together, rather than after someones had to tease them apart again).

throws can of worms on the ground and quickly walks away


Good point, thanks. I added this field when I tested what I could easily import but it doesn’t make sense to keep it (the point is to copy hard cold fact-checkable data, not descriptions)

I removed this field in the new script version (2016.7.6)


Thank you for the quick update. I forgot to mention this in my previous post: this userscript is going to save met centuries of time editing. Thank you very much.


I’ve installed it myself now and done some quick experiments. It seems to work alright for the case of adding a new artist; but when I open the edit page for an existing artist that already has a Wikidata link, nothing happens except for the banner inviting me to paste a WD link.

I believe @reosarevok reported something similar for Chrome, but I’m on Firefox (latest ESR). Maybe it’s related to us both using beta?


Click the URL field containing the existing wikidata URL; press any key (any arrow key for instance) and voilà.
But it will add quite some duplicate URL in my experience. Remove the lower ones or you will queue some ADD + REMOVE edits.


Glad to hear it :slight_smile:

As @jesus2099 says, the behavior is triggered when one “external link” text area is modified and a wikidata URL is detected, so nothing happens because of pre-existing wikidata links.

Yes, unfortunately, I haven’t done the detection yet. I thought of a way to make it (filter domains already linked) but haven’t done it because I didn’t need it myself, now may be the time :slight_smile:

[technical mumbo-jumbo] Part of the head scratching with dealing with the external links here is that this part of the page is created on the fly by React and I can’t attach event listeners beforehand when loading the page[/]


Really cool script! Some thoughts:

  1. It seems like the script automatically changed the sort name of an artist without notifying, resulting in edit #46857757, possibly because it instead noted that Wikidata’s name was different from MB’s. It would be good if this change were more clear. You should be able to test this exact behavior until the edit closes.
  2. It seems like the script doesn’t import all URLs. In particular I noticed Facebook and Instagram were missing. It should probably import all URLs that MB automatically recognizes.
  3. These thoughts should probably go on the GitHub repo instead of this forum, shouldn’t they? Sorry :slightly_smiling_face:



  1. I’ll take a look
  2. The script needs to know the wikidata code for each of those links, so I only added the ones I needed. I’ll update the list
  3. Up to you. I prefer to use the bitbucket tracker, but you can send me a message through musicbrainz or use github if you prefer