Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Every time you visit for the FIRST TIME today... [Part 1]

Name: Anonymous 2013-10-20 22:56

Post a random function that you made. May be from any project you've done or make one impromptu.

Any QUALITY is allowed. No bullying!

Name: Anonymous 2013-11-19 0:44

>>85
use HTML::TreeBuilder::XPath;

my $tree = HTML::TreeBuilder::XPath->new;
my $host = 'http://otokei-douj.in';

my $res = $ua->request(HTTP::Request->new(GET => "$host/"));
die "$res->status_line" unless $res->is_success;

$tree->parse(decode_utf8($res->content));
my @playlist = $tree->findnodes('//ul[@class="playlist"]/li/a');
my $album_url = $playlist[rand @playlist]->attr('href');

Insert error handling as desired, also you might want to make this a sub since you call it a couple of times (once for the main page, once for the artist(?) page)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List