Created
August 24, 2015 19:49
-
-
Save xjackk/cf719e99ebdc6b81c831 to your computer and use it in GitHub Desktop.
Cartoon Network TV Listings
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
#!/usr/bin/perl -w | |
# List Cartoon Networking TV Listings. | |
# Because I am bored, and watch cartoons.. | |
use strict; | |
use URI; | |
use LWP::Simple; | |
use Web::Scraper; | |
use Data::Dumper; | |
use Encode; | |
# Listing site | |
# Cartoon Network | |
my $schedule = "http://www.locatetv.com/listings/cartoon-network"; | |
# 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)); | |
# dumper for debuggin' | |
#print Dumper($res); | |
# Pretty stylin' | |
print "\n\t Cartoon Network 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