Skip to content

Instantly share code, notes, and snippets.

@vincerubinetti
Created December 3, 2025 18:02
Show Gist options
  • Select an option

  • Save vincerubinetti/d429520fc6b0acf39cc0ace05341c706 to your computer and use it in GitHub Desktop.

Select an option

Save vincerubinetti/d429520fc6b0acf39cc0ace05341c706 to your computer and use it in GitHub Desktop.
Run in dev console on Bandcamp stats page to get albums and track listings
const data = JSON.parse(document.getElementById("pagedata").dataset.blob);
const user_id = data.identities.user.id;
const band_id = data.identities.page_band.id;
const url = new URL(window.location.origin);
url.searchParams.set("user_id", user_id);
url.searchParams.set("band_id", band_id);
const get = async () => await (await fetch(url)).json();
url.pathname = "api/mobile/25/band_details";
const { bandcamp_url, discography } = await get();
const releases = await Promise.all(
discography.map(async ({ item_id, item_type }) => {
url.pathname = "api/mobile/25/tralbum_details";
url.searchParams.set("tralbum_id", item_id);
url.searchParams.set("tralbum_type", item_type === "track" ? "t" : "a");
return await get();
})
);
console.log(releases);
@vincerubinetti
Copy link
Author

vincerubinetti commented Dec 3, 2025

releases
  .map(({ tracks, bandcamp_url }) =>
    tracks.map(({ title }) => ({ track: title, album_link: bandcamp_url }))
  )
  .flat();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment