Last active
November 9, 2025 02:15
-
-
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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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