Last active
November 19, 2017 10:32
-
-
Save paveljurca/7263fd17d53a3fddfbcb669b54f008ab to your computer and use it in GitHub Desktop.
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
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
use HTTP::Request::Common; | |
use constant API => shift; | |
$ua = new LWP::UserAgent; | |
$ua->agent('Mozilla/8.0'); | |
my @html = split m|<div class="title">|, | |
$ua->request(GET API)->decoded_content; | |
my ($bc, $album) = (split '/album/', API); | |
$album =~ s/[^\w-]//g; | |
mkdir $album; | |
chdir $album; | |
shift @html; | |
for (@html) { | |
my ($track) = m|<a href="([^"]+)|; | |
# sleep 1; | |
system 'youtube-dl', qw(-o %(title)s.%(ext)s --restrict-filenames), $bc.$track; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment