Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
teamliquid top stream scraper
#!/usr/bin/perl
# TL stream scraper !
use strict;
use URI;
use LWP::Simple;
use Web::Scraper;
use Data::Dumper;
use Encode;
my $teamliquid = "http://www.teamliquid.net";
my $content = scraper {
process "div#streams_content div", "streams[]" => scraper {
process "a.rightmenu", streamer => 'TEXT';
process "span.viewers", viewers => 'TEXT';
};
};
my $res = $content->scrape(URI->new($teamliquid));
#print Dumper($res);
print "\n\t Team Liquid Top Streamers \n\n";
print "\t ----------------------------\n\n";
for my $shit (@{$res->{streams}}) {
print "Streamer : " . $shit->{streamer} . "\t";
print "\t";
print "# of viewers : " . $shit->{viewers};
print "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment