Last active
August 29, 2015 14:24
-
-
Save vtajzich/a38fe74230b12cd366b0 to your computer and use it in GitHub Desktop.
How to download a movies form regiojet train server :-)
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
class Movie { | |
String name | |
URL url | |
} | |
def downloads = new File('downloads') | |
downloads.mkdirs() | |
"http://portal.regiojet.cz/files/movies/".toURL().text.findAll(~/(?<=href=")([\S^"]*)(?=")/) | |
.parallelStream() | |
.filter({ it.contains('.mp4') || it.contains('.m4v') }) | |
.map({ new Movie(name: it, url: "http://portal.regiojet.cz/files/movies/$it".toURL()) }) | |
.peek({ println "Downloading: " + it.name}) | |
.forEach({ new File(downloads, it.name) << it.url.openStream() }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment