Last active
December 5, 2017 16:58
-
-
Save jberger/b5e35ffd5231ad44ef6178d4a94fba27 to your computer and use it in GitHub Desktop.
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
use Mojo::Base -strict; | |
use Mojo::UserAgent; | |
my $ua = Mojo::UserAgent->new->max_redirects(10); | |
my $success = 0; | |
$ua->on(start => sub { | |
my ($ua, $tx) = @_; | |
$tx->res->content->unsubscribe('read')->on(read => sub { | |
my (undef, $chunk) = @_; | |
$success = 1 if length $chunk; | |
$tx->res->error({message => 'interrupting stream'}); | |
}); | |
}); | |
my $url = 'http://rrr.sz.xlcdn.com/?account=rtv_oost&file=RadioOost_mp3&type=live&service=icecast&output=m3u'; | |
$ua->get($url); | |
say $success ? 'Success' : 'Failure'; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment