Skip to content

Instantly share code, notes, and snippets.

@Veedrac
Last active July 29, 2024 03:25
Show Gist options
  • Save Veedrac/e0275a4ad04fa03738e99fb6878bf83a to your computer and use it in GitHub Desktop.
Save Veedrac/e0275a4ad04fa03738e99fb6878bf83a to your computer and use it in GitHub Desktop.

Be aware that malicious scripts can steal your account.

  1. Go to https://mrcoles.com/bookmarklet/
  2. Paste the code above into the textbox
  3. [optional] Name the bookmarklet, eg. ‘🔀 shuffle’
  4. Click ‘Convert to bookmarklet’
  5. Drag the bookmarklet to your bookmarks bar
(async function(){
async function moveItem(playlistId, toIndex, fromIndex) {
const response = await fetch("https://studio-api.suno.ai/api/playlist/update_clips/", {
method: "POST",
headers: {
"accept": "*/*",
"content-type": "application/json;charset=UTF-8",
"authorization": "Bearer " + await Clerk.session.getToken()
},
body: JSON.stringify({
playlist_id: playlistId,
update_type: "reorder",
metadata: { to_index: toIndex, from_index: fromIndex }
})
});
await response.text();
}
const playlistId = new URL(window.location.href).pathname.split("/").pop();
const nSongs = document.querySelector('[aria-label$=" Clips"]').childElementCount;
for (var i = 0; i < nSongs; ++i) {
const takeFrom = i + Math.floor(Math.random() * (nSongs - i));
if (takeFrom > i) {
await moveItem(playlistId, i, takeFrom);
}
}
location.reload();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment