Skip to content

Instantly share code, notes, and snippets.

@loganj
Created October 19, 2009 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loganj/213083 to your computer and use it in GitHub Desktop.
Save loganj/213083 to your computer and use it in GitHub Desktop.
package scamz
import org.apache.commons.codec.binary.Base64
import io.Source
import xml.{Node, XML}
import java.io.{FileOutputStream, File}
import scalax.io.{OutputStreamResource, InputStreamResource}
object Scamz extends AmazonCipherFactory {
def main(args: Array[String]) : Unit = {
val encrypted = new Base64().decode(Source.fromFile(args(0)).mkString);
val decrypted = XML.loadString(new String(amazonCipher.doFinal(encrypted)).trim)
val tracks = (decrypted \\ "track")
tracks.foreach( track => {
val url = (track \ "location").text
val file = (track \ "trackNum").text + " - " + (track \ "title").text + ".mp3"
println(file)
InputStreamResource.url(url).pumpTo(OutputStreamResource.file(file))
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment