-
-
Save vors/13602d68a48d1661ccbc to your computer and use it in GitHub Desktop.
Scrap mp3 urls from vk.com music pages
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
var trackElements = document.querySelectorAll(".audio"); | |
console.log("Loaded " + trackElements.length + " track"); | |
var tracks = []; | |
for (var i = 0; i < trackElements.length; ++i) { | |
var trackElement = trackElements[i]; | |
var input = trackElement.querySelector("input"); | |
var title = trackElement.querySelector(".title_wrap"); | |
if (!input || !title) { | |
console.warn("DOM is irregular?!"); | |
continue; | |
} | |
var url = input.value.split("?").shift(); | |
var name = title.textContent.trim(); | |
tracks.push({name: name, url: url}); | |
} | |
var text = ""; | |
for (var i = 0; i < tracks.length; ++i) | |
text += (tracks[i].url + "@" + tracks[i].name) + "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment