Created
November 29, 2015 23:27
-
-
Save korzo/a9699b3dd33c971fa645 to your computer and use it in GitHub Desktop.
Last FM export playlist
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
// http://jsbin.com/vivucuceco/edit?output | |
var csv = '', | |
link, | |
div; | |
jQuery("#thePlaylist tr").each(function(i,e){ | |
if (i > 0) { | |
var as = jQuery("a", jQuery("td", e)[2]).each(function(j, el){ | |
csv = csv + '"'+ el.innerHTML + '";"' + el.href + '"'; | |
if (j === 0) { | |
csv = csv + ';'; | |
} | |
}); | |
csv = csv + "\n"; | |
} | |
}); | |
link = document.createElement("A"); | |
link.href = 'data:text/plain;charset=utf-8,'+encodeURIComponent(csv); | |
link.download = "playlist.csv"; | |
link.innerHTML = 'DOWNLOAD'; | |
jQuery(link).css({ | |
"position" : "absolute", | |
"top" : "50%", | |
"left" : "50%", | |
"background" : "blue", | |
"color" : "white", | |
"z-index" : 1000, | |
"padding" : "10px" | |
}); | |
div = document.createElement("DIV"); | |
jQuery(div).css({ | |
"position" : "absolute", | |
"top" : 0, | |
"bottom" : 0, | |
"left" : 0, | |
"right" : 0, | |
"background" : "rgba(0, 0, 0, 0.6)" | |
}).append(link); | |
jQuery("body").append(div); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment