december bandcamp friday picks

πŸ”— posted 2020-12-04

πŸ”™ back to index

Generating all these dang embeds

Step 1: Load a bandcamp page

Step 2: Run this thing in devtools

!function createEmbed(){
  let $$ = (sel) => document.querySelector(sel);
  let albumUrl = window.location.toString();
  let albumId = JSON.parse(pagedata.dataset.blob).album_id;
  let albumName = $$("#name-section .trackTitle").innerText;
  let artistName = $$("#name-section h3 span a").innerText;
  let size = "350px";

  copy(`<iframe style="border: 0; width: ${size}; height: ${size};" src="https://bandcamp.com/EmbeddedPlayer/album=${albumId}/size=large/bgcol=333333/linkcol=0f91ff/minimal=true/transparent=true/" seamless></iframe><br/><a href="${albumUrl}">${artistName} – ${albumName}</a>`)
}()

Step 3: Now the embed code is in my clipboard