User script to load artist data from wikipedia

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 Sviatoslav Richter - Wikipedia to musicbrainz, I would need to find the wikidata entry address (available from the left side column, Tools > “Wikidata item”), i.e. Sviatoslav Richter - Wikidata, 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” :)]


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

1 Like

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)

1 Like

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[/]

1 Like

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

Sorry for reviving this old topic, but I just discovered this script and I think it’s awesome.
It’s actually the first user script I got to work.

Here is my feedback:

  1. The script thinks “United States” and “United States of America” are different values. Same with “New York” and “New York City” and probably some other areas.
  2. The script often adds links that are already added - especially official homepages. (:heavy_check_mark:) (I’ll have to do some more testing and I’ll report back whether this is fixed)
  3. The script seems to like adding http links. I haven’t checked yet whether these links don’t work as https or it’s just a quirk of the script. :heavy_check_mark: (lots more https links now.)
  4. Is there a way to set a custom text to use as an edit note? Having to copy-paste the Wikidata link messes with my ability to copy-paste a custom edit note. (:heavy_check_mark:) (now edit notes are at least not overwritten, so I can copy-paste my edit note before and then run the script.)
1 Like

Thanks :slight_smile:

You mean if US is already set and the script warns about replacing it by USA? That would be tricky to fix (needs another search on areas) and it seems low priority.

Could you give me an example? I have to check how duplicates are found

Good point. Some are mandatory (BNF, and I think VIAF had problems with https), others should be updated, I’ll do it.

Not right now, but I should at least fix the script so that it doesn’t remove an existing edit note

Thanks for the feedback


Yes, that’s what I mean and you’re right it’s not a big deal. Every user of the script will recognize that it’s the same area.

Just came across this artist: Bernhoft
is already added as official homepage and the script adds:
as a link where I still have to choose which type it is. Once I choose “official homepage” MB tells me it’s a duplicate.
It’s usually official homepages. Sometimes there is a slight difference in the links (like missing / on the end) but often - like in this case - it’s the exact same link.
Not too big of an issue either though.

That would be very helpful.

Thanks for the fast reply. :slight_smile:

1 Like

Sorry, I’m really a newb in Greasemonkey. And in many other things :slight_smile:
I’ve just installed Greasemonkey and this script (MusicBrainz edit:)

I’ve tried to edit the artist Smiley - but it already has a WikiData link. I tried to delete it and to copy it again but nothing happens.

Is it possible to make the script work in such cases (When the WikiData link already exists)?

I got Firefox version 61.0.1 on Windows 64 bit

Another question: can the WikiData entries contain a ID?
I noticed that the WikiData entry for U2 doesn’t have one -

Also I would like to add a feature request:
Add a button (or link) for searching the artist name in WikiData. In case it’s possible, add a link for opening the first result of the WikiData search (if there is an exact match for the name).

For example at Manuel Riva - the script would create a link to the search on WikiData. And maybe even create a link to the first result - Manuel Riva (Q55407174). Most of the time, the first result is the right one.

That would spare the users from copying / pasting the artist name - when doing it repeatedly, it can save a lot of time.


I installed the script via Tampermonkey because Greasemonkey didn’t work for me. Now when I add or edit an artist there is a box on the right side where I can copy the WD link (no matter if the artist already has one or not) to start the script.