Skip to content

Instantly share code, notes, and snippets.

@ZachSaucier
Last active February 18, 2025 23:54
Show Gist options
  • Save ZachSaucier/ecb911278a999b1d4bb505cd5548bb4e to your computer and use it in GitHub Desktop.
Save ZachSaucier/ecb911278a999b1d4bb505cd5548bb4e to your computer and use it in GitHub Desktop.
const hrefs = [...document.querySelectorAll('.albumThumb a[href*="playlist.view?id="]')].map((e) => e.href);
let lastPlaylistId = -1;
hrefs.forEach((e) => {
const id = parseInt(new URL(e)?.searchParams?.get('id'));
if (id > lastPlaylistId) {
lastPlaylistId = id;
}
});
for (let i = 1; i <= lastPlaylistId; i++) {
let index = i;
let error = false;
try {
await fetch(`http://192.168.0.16:4040/exportPlaylist.view?id=${index}`).then(e => error = e.status >= 400)
} catch(e) {}
if (!error) {
setTimeout(() => window.location = `exportPlaylist.view?id=${i}`, index * 100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment