Created
August 23, 2020 12:46
-
-
Save litvinovvo/d02b8a9d130eabd6877bed38230b0d20 to your computer and use it in GitHub Desktop.
add vk audio to the given playlist
This file contains 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
// scroll down fully | |
var songs = document.querySelectorAll('.audio_row'); | |
var playlistId = '15359214_51903820'; | |
for (var i = songs.length - 1; i >= 0; i--) { | |
console.log(i, 'more'); | |
const mouseoverEvent = new Event('mouseover'); | |
songs[i].dispatchEvent(mouseoverEvent); | |
await new Promise((a)=>setTimeout(a, 500)); | |
songs[i].querySelector('.audio_row__action_more').click(); | |
await new Promise((a)=>setTimeout(a, 500)); | |
songs[i].querySelector('.audio_row__more_action_add_to_playlist').click(); | |
await new Promise((a)=>setTimeout(a, 1500)); | |
if (!songs[i].querySelector('.audio_row__more_action_pl_' + playlistId).classList.contains('audio_row__more_playlist_added')) { | |
songs[i].querySelector('.audio_row__more_action_pl_' + playlistId).click() | |
} | |
await new Promise((a)=>setTimeout(a, 500)); | |
songs[i].remove(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment