Skip to content

Instantly share code, notes, and snippets.

@MrCirdo
Created June 11, 2016 08:11
Show Gist options
  • Save MrCirdo/f010293ae9376435fc48fd049c07e265 to your computer and use it in GitHub Desktop.
Save MrCirdo/f010293ae9376435fc48fd049c07e265 to your computer and use it in GitHub Desktop.
Download Music from www.keygenmusic.net
set urlPage to ""
tell application "Safari"
set urlPage to URL of front document
end tell
repeat while urlPage does not contain "http://www.keygenmusic.net/?page=team&teamname="
set urlPage to text returned of (display dialog "Entrer l'url de la page: " default answer "")
end repeat
tell application "Safari"
open location urlPage
activate
delay 3
set links to (do JavaScript "var element = document.getElementsByClassName('menu');var array = []; for (var i = 0; i < element.length; i++){if (element[i]['href'].indexOf('http://www.keygenmusic.net/music/') != -1){array.push(element[i]['href']);}}array;" in front document)
repeat with link in links
open location link
end repeat
delay 5
close (every tab of window 1 whose name = "Sans Titre")
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment