Skip to content

Instantly share code, notes, and snippets.

@colomon
Created February 12, 2018 00:05
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 colomon/4d4761d55d11ff7491cbc65a5193204d to your computer and use it in GitHub Desktop.
Save colomon/4d4761d55d11ff7491cbc65a5193204d to your computer and use it in GitHub Desktop.
use v6;
use LibCurl::Easy;
for $*IN.comb(/ <?after 'href="'> (<-["]>+ ['mp3' | 'pdf']) /) -> $url {
if $url ~~ m{ ^ 'http://www.buddhistbassoonquartet.org/' (.*) } {
my $filename = $0.subst('%20', '_', :global).IO;
my $dirname = $filename.dirname.IO;
unless $dirname.e {
$dirname.mkdir;
}
LibCurl::Easy.new(URL => $url,
download => ~$filename).perform;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment