Skip to content

chaban-mb/bookmarklets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 

Repository files navigation

MusicBrainz Bookmarklets

A collection of bookmarklets for MusicBrainz.

Dedicated support thread

Disclaimer

These scripts were created with the help of Google Gemini. While they are functional, they may not always be perfect. I am not a developer, so my ability to fix complex issues is limited. Please report any bugs or issues, and I will do my best to address them.

Installation

To install a bookmarklet, create a new bookmark in your browser and paste the code snippet from the respective section below into the URL field.

Bookmarklets

Approve all edits on current page

Requires the power vote script.

javascript:(()=>{document.querySelectorAll('a.positive[href*=approve]').forEach(el=>el.click());})();

Toggle relationships for removal

javascript:(()=>{document.querySelectorAll('.relationship-list .remove-item').forEach(el=>el.click());})();

Toggle links for removal

javascript:(()=>{document.querySelectorAll('[title="Remove link"]').forEach(el=>el.click());})();

Add currently viewed entity to merge queue

javascript:(()=>{document.querySelector('#sidebar [href*="merge_queue"]')?.click();})();

Submit edit votable

javascript:(()=>{document.querySelector('.make-votable, [name*="make_votable"]')?.click();document.querySelector('#enter-edit, button.submit, #submitAliases')?.click();})();

Open current page in Harmony

javascript:(()=>{const S=[{s:'meta[property="music:album"]',p:'content'},{s:'meta[property="music:album:url"]',p:'content'},{s:'meta[name="music:album"]',p:'content'},{s:'meta[property="og:url"]',t:'meta[property="og:type"][content="music.album"]',p:'content'},{s:'[data-testid="entityTitle"]~div a[href^="/album/"]',p:'href'},{s:'[data-testid="track-page"]>div:first-child a[href^="/album/"]',p:'href'}];const u=S.reduce((a,i)=>{if(a)return a;const e=document.querySelector(i.s);return(e&&(!i.t||document.querySelector(i.t)))?e[i.p]:null},null)||location.href;const h=new URL('https://harmony.pulsewidth.org.uk/release');h.searchParams.set('url',u);h.searchParams.set('category','preferred');location.href=h.toString();})();

Open current page in Harmony (new tab)

javascript:(()=>{const S=[{s:'meta[property="music:album"]',p:'content'},{s:'meta[property="music:album:url"]',p:'content'},{s:'meta[name="music:album"]',p:'content'},{s:'meta[property="og:url"]',t:'meta[property="og:type"][content="music.album"]',p:'content'},{s:'[data-testid="entityTitle"]~div a[href^="/album/"]',p:'href'},{s:'[data-testid="track-page"]>div:first-child a[href^="/album/"]',p:'href'}];const u=S.reduce((a,i)=>{if(a)return a;const e=document.querySelector(i.s);return(e&&(!i.t||document.querySelector(i.t)))?e[i.p]:null},null)||location.href;const h=new URL('https://harmony.pulsewidth.org.uk/release');h.searchParams.set('url',u);h.searchParams.set('category','preferred');window.open(h.toString(),'_blank');})();

Multi-tool

Go to next release editor tab, apply guess case, submit edit, confirm seeding form and OAuth, reload on error, update release from Harmony or seed it, go to ISRC submitter.

javascript:(function(){const errs=['rate limit','Failed to fetch resource at','Too many requests queued'];if((location.hostname.includes('magicisrc')&&document.querySelector('#container h1')?.innerText.includes('error'))||(location.hostname.includes('harmony.pulsewidth.org.uk')&&Array.from(document.querySelectorAll('.message p')).some(p=>errs.some(e=>p.textContent?.includes(e))))){location.reload();}else if(location.href.includes('musicbrainz.org/release')&&typeof MB!=='undefined'&&MB?._releaseEditor){const releaseEditor=MB._releaseEditor;switch(releaseEditor.activeTabID()){case "#tracklist":if(document.querySelectorAll(".capitalized-eti, .miscapitalized-titles").length!==0){document.querySelector("#guess-case-button")?.click();}else{const isReuseRecordingsDialogOpen=document.querySelector('[data-click="reuseUnsetPreviousRecordings"]');if(isReuseRecordingsDialogOpen){releaseEditor.nextTab();}else{const allEdits=releaseEditor.allEdits();const hasTrackEdits=allEdits.some(e=>[51,52,53].includes(e.edit_type));if(hasTrackEdits){releaseEditor.nextTab();}else{releaseEditor.lastTab();}}}break;case "#edit-note":releaseEditor.submitEdits();break;default:releaseEditor.nextTab();break;}}else if(document.getElementsByClassName('MMR2099userjs120382').length!==0){document.querySelector('[ref="Merge all found recordings"]')?.click();}else if(location.hostname.includes('harmony.pulsewidth.org.uk')){(document.querySelector('[value="Update external links in MusicBrainz"]')||document.querySelector('[value="Import into MusicBrainz"]')||document.querySelector('.magic-isrc'))?.click();}else if(!document.querySelector('h1 .mp [href^="/url/"]')){document.querySelectorAll('#enter-edit, #edit-submit, button.submit, #submit-button, #submitAliases, #batch_video, #check-isrcs button[type=button], #index-mbid-submit, .confirm-seed button[type="submit"], form[action*="importisrc"][method="post"] .btn, a[href*="importisrc?releaseId="], a[href^="https://musicbrainz.org/oauth2/authorize"]')[0]?.click();}})();

Convert to pseudo-release

javascript:(()=>{ $('[title="Remove link"]').click(); document.querySelectorAll('.remove-release-event, .remove-release-label').forEach(el=>el.click()); $('#status').val('4').trigger('change');  $('#barcode').val('').trigger('change'); $('#no-barcode').prop('checked', false); $("select[id|='packaging']").val('').trigger('change') ; $("select[id|='medium-format']").val('').trigger('change'); $('.format input[type=checkbox]').prop('checked', false); $('.format input[type=checkbox]').click(); $('.track-length').val('').trigger('change'); $("[href^='#edit-note']").click(); $('#edit-note-text').val('pseudo-release').trigger('change'); })();

Lookup current page URL in MusicBrainz

javascript:(()=>{window.open(`https://musicbrainz.org/otherlookup/url?other-lookup.url=${encodeURIComponent(location.href)}`);})();

Search for YouTube video in archives with YouTube Video Finder

javascript:(()=>{if(location.hostname.includes('youtube.com')){window.open(`https://findyoutubevideo.thetechrobo.ca/noscript_load.html?d=${encodeURIComponent(location.href)}`);}})();

Open YouTube page in MW Metadata

javascript:(()=>{if(location.hostname.includes('youtube.com')){window.open(`https://mattw.io/youtube-metadata/?url=${encodeURIComponent(location.href)}&submit=true`);}})();

Open current Spotify or Deezer page in ISRC Hunt (new tab)

javascript:(()=>{const h=location.href;const m=[{r:/open\.spotify\.com\/(?:[^/]+\/)?(?:playlist|artist)/,u:`https://isrchunt.com/?spotifyPlaylist=${h}`},{r:/open\.spotify\.com\/(?:intl-[a-z]+\/)?album/,u:`https://isrchunt.com/spotify/importisrc?releaseId=${h}`},{r:/www\.deezer\.com\/[^/]*\/album/,u:`https://isrchunt.com/deezer/importisrc?releaseId=${h}`}].find(x=>x.r.test(h));if(m)window.open(m.u,null,"noopener")})()

Open current artist page in SAMBL

javascript:(()=>{const p={spotify:/spotify\.com\/artist\/(?:intl-[a-z]+\/)?(?<id>\w+)/,deezer:/deezer\.com\/.*artist\/(?<id>\d+)/,tidal:/tidal\.com\/.*artist\/(?<id>\d+)/,bandcamp:/:\/\/(?<id>[^.]+)\.bandcamp\.com/,soundcloud:/(?<id>^https?:\/\/soundcloud\.com\/[^\/?#]+)/};for(const[k,r]of Object.entries(p)){const m=location.href.match(r);if(m){location.href=`https://sambl.lioncat6.com/newartist?provider=${k}&provider_id=${encodeURIComponent(m.groups.id)}`;break}}})();

Open current artist page in SAMBL (new tab)

javascript:(()=>{const p={spotify:/spotify\.com\/artist\/(?:intl-[a-z]+\/)?(?<id>\w+)/,deezer:/deezer\.com\/.*artist\/(?<id>\d+)/,tidal:/tidal\.com\/.*artist\/(?<id>\d+)/,bandcamp:/:\/\/(?<id>[^.]+)\.bandcamp\.com/,soundcloud:/(?<id>^https?:\/\/soundcloud\.com\/[^\/?#]+)/};for(const[k,r]of Object.entries(p)){const m=location.href.match(r);if(m){window.open(`https://sambl.lioncat6.com/newartist?provider=${k}&provider_id=${encodeURIComponent(m.groups.id)}`);break}}})();

Show API data for Qobuz album

javascript:(()=>{const s=window.location.href.match(/\/([0-9a-z]+)$/)?.slice(1);s&&window.open(((s)=>`https://www.qobuz.com/api.json/0.2/album/get?album_id=${s}&app_id=712109809`)(...s))})();

Show API data for Deezer album

javascript:(()=>{const s=window.location.href.match(/deezer\.com\/\w{2}\/(album\/[0-9]+)$/)?.slice(1);s&&window.open(((s)=>`https://api.deezer.com/${s}`)(...s))})();
javascript:(()=>{window.open(`https://seed.musichoarders.xyz?identifier=${encodeURIComponent(location.href)}`);})();

Convert URLs with "album/" or "release/" to Harmony links

javascript:(()=>{document.querySelectorAll('a[href*="album/"], a[href*="release/"]').forEach(a=>{a.href=`https://harmony.pulsewidth.org.uk/release?url=${encodeURIComponent(a.href)}&category=preferred`;});})();

Convert URLs with "/album" to ISRC Hunt links

javascript:(()=>{document.querySelectorAll('a[href*="album/"]').forEach(a=>{a.href=`https://isrchunt.com/spotify/importisrc?releaseId=${encodeURIComponent(a.href)}`;});})();

Convert supported artist URLs to SAMBL links

javascript:(()=>{const i=location.hostname.includes('soundcloud.com');let s='a[href*="/artist/"],a[href*=".bandcamp.com"]';if(!i)s+=',a[href*="soundcloud.com/"]';if(i)s+=',a[class*="username"]:not([aria-haspopup="true"]),a[class*="Badge"]:not([aria-haspopup="true"]),a[class*="avatar"]:not([aria-haspopup="true"])';const p={spotify:/spotify\.com\/(?:intl-[a-z]+\/)?artist\/(\w+)/,deezer:/deezer\.com\/.*artist\/(\d+)/,tidal:/tidal\.com\/.*artist\/(\d+)/,bandcamp:/:\/\/([^.]+)\.bandcamp\.com/,soundcloud:/soundcloud\.com\/([^\/?#]+)(?:$|[?#])/};document.querySelectorAll(s).forEach(a=>{const u=a.href;let k=0,id=0;Object.entries(p).some(([prov,r])=>{const m=u.match(r);if(m){k=prov;id=prov==='soundcloud'?'https://soundcloud.com/'+m[1]:m[1];return true}});if(k)a.href=`https://sambl.lioncat6.com/newartist?provider=${k}&provider_id=${encodeURIComponent(id)}`})})();

Convert supported artist URLs to SAMBL links (new tab)

javascript:(()=>{const i=location.hostname.includes('soundcloud.com');let s='a[href*="/artist/"],a[href*=".bandcamp.com"]';if(!i)s+=',a[href*="soundcloud.com/"]';if(i)s+=',a[class*="username"]:not([aria-haspopup="true"]),a[class*="Badge"]:not([aria-haspopup="true"]),a[class*="avatar"]:not([aria-haspopup="true"])';const p={spotify:/spotify\.com\/(?:intl-[a-z]+\/)?artist\/(\w+)/,deezer:/deezer\.com\/.*artist\/(\d+)/,tidal:/tidal\.com\/.*artist\/(\d+)/,bandcamp:/:\/\/([^.]+)\.bandcamp\.com/,soundcloud:/soundcloud\.com\/([^\/?#]+)(?:$|[?#])/};document.querySelectorAll(s).forEach(a=>{const u=a.href;let k=0,id=0;Object.entries(p).some(([prov,r])=>{const m=u.match(r);if(m){k=prov;id=prov==='soundcloud'?'https://soundcloud.com/'+m[1]:m[1];return true}});if(k){a.href=`https://sambl.lioncat6.com/newartist?provider=${k}&provider_id=${encodeURIComponent(id)}`;a.target="_blank"}})})();

Search for releases of current artist or label

javascript:(()=>{const m=location.pathname.match(/\/(artist|label)\/([a-f0-9-]{36})/);if(m)window.open(`${location.origin}/search?query=${m[1]==='artist'?'arid':'laid'}:${m[2]}&type=release&limit=100&method=advanced`);})();

Search for recordings of current release, release group, or artist

javascript:(()=>{const m=location.pathname.match(/\/(release|release-group|artist)\/([a-f0-9-]{36})/);if(m){const p={'release':'reid','release-group':'rgid','artist':'arid'};window.open(`${location.origin}/search?query=${p[m[1]]}:${m[2]}&type=recording&limit=100&method=advanced`);}})();

About

Bookmarklets for MusicBrainz.org and then some

Topics

Resources

Stars

Watchers

Forks