Skip to content

Instantly share code, notes, and snippets.

@xjackk
Last active November 2, 2015 00:29
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 xjackk/1081034747938446f2dd to your computer and use it in GitHub Desktop.
Save xjackk/1081034747938446f2dd to your computer and use it in GitHub Desktop.
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