Skip to content

Instantly share code, notes, and snippets.

@xjackk
Created November 4, 2015 00:58
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/29f39a2d8c870fd1d40f to your computer and use it in GitHub Desktop.
Save xjackk/29f39a2d8c870fd1d40f to your computer and use it in GitHub Desktop.
Comedy Central TV Listings
#!/usr/bin/perl -w
# Comedy central listings
use strict;
use URI;
use LWP::Simple;
use Web::Scraper;
use Data::Dumper;
use Encode;
# Listing site
# Comedy Central
my $schedule = "http://www.locatetv.com/listings/comedy-central";
# scrapin' with Web::Scraper.
my $shows = scraper {
process "li.schedTv", "shows[]" => scraper {
process "a.pickable", title => 'TEXT';
process "li.time", "times" => 'TEXT';
};
};
# lets print that shit out
my $res = $shows->scrape(URI->new($schedule));
# Pretty stylin'
print "\n\t Comedy Central TV Listings \n\n";
print "\t -----------------------\n\n";
# pretty print my shit
for my $shows (@{$res->{shows}}) {
print $shows->{title};
print "\t-- " . $shows->{times};
# give it a new line yo
print "\n\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment