Created
May 2, 2020 11:37
-
-
Save rustcohlnikov/ba25b3a665ee6a1b9275cf6d47fb984f to your computer and use it in GitHub Desktop.
Download VK music titles as text file
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
// 1. Manually scroll down and load all the music on your library | |
// 2. Paste code into console and hit Enter | |
// 3. Type `getMusic()` | |
// 4. `music.txt` files is downloaded | |
function getMusic() { | |
let songs = []; | |
let nodes = document.querySelectorAll('div.audio_row_content'); | |
for (let index = 0; index < nodes.length; index++) { | |
const element = nodes[index]; | |
const songName = element.querySelector('.audio_row__title_inner').textContent; | |
const artistName = element.querySelector('.audio_row__performer_title a').textContent; | |
songs.push(`${artistName} - ${songName}`); | |
} | |
const a = document.createElement('a'); | |
a.download = 'music.txt'; | |
const objectUrl = URL.createObjectURL(new Blob([songs.join("\n")], { type: 'text/plain' })); | |
a.href = objectUrl; | |
a.click(); | |
delete a; | |
URL.revokeObjectURL(objectUrl); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment