Skip to content

Instantly share code, notes, and snippets.

@TolyanDimov
Last active November 9, 2025 02:15
Show Gist options
  • Select an option

  • Save TolyanDimov/f3465fed547e06d6ffb100abda6b63d5 to your computer and use it in GitHub Desktop.

Select an option

Save TolyanDimov/f3465fed547e06d6ffb100abda6b63d5 to your computer and use it in GitHub Desktop.
Desktop browser console script to bulk-remove all tracks from VKontakte "My Music".
(async () => {
// Доскролл до низа страницы (пока смещение растёт)
let last = -1;
while (true) {
window.scrollBy(0, 1000);
await new Promise(r => setTimeout(r, 300));
const y = window.pageYOffset;
const atBottom = window.innerHeight + y >= document.body.scrollHeight - 5;
if (atBottom || y === last) break;
last = y;
}
// Собираем треки
const rows = Array.from(document.querySelectorAll('.audio_row'));
// Удаляем по одному, корректно обрабатывая промисы/непромисы
for (const el of rows) {
const full = el.getAttribute('data-full-id');
if (!full) continue;
const [ownerId, audioId] = full.split('_');
try {
const res = deleteAudioOnClaim(ownerId, audioId);
if (res && typeof res.then === 'function') {
await res; // если функция возвращает промис — ждём
} else {
await new Promise(r => setTimeout(r, 200)); // иначе даём бэкенду время
}
} catch (e) {
console.error('Не смог удалить', full, e);
}
}
// Если нужна перезагрузка после удаления, раскомментируйте строку ниже:
// location.reload();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment