Skip to content

Instantly share code, notes, and snippets.

@gkbrk
Created April 11, 2016 20:03
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 gkbrk/b014851043fa4a8e472bbd01ecf2bad9 to your computer and use it in GitHub Desktop.
Save gkbrk/b014851043fa4a8e472bbd01ecf2bad9 to your computer and use it in GitHub Desktop.
Serie tracker
#!/usr/bin/env perl
use strict;
use warnings;
use HTTP::Tiny;
sub http_get {
my $http = HTTP::Tiny->new;
return $http->get($_[0])->{content};
}
my @series;
my $html = http_get "http://dizimag.co/";
while ($html =~ /alt="(.*) (.*)\. Sezon (.*)\. Bölüm" class="avatar" width=40\>/g) {
push(@series, $1." Season ".$2." Episode ".$3);
}
my @favorites = ("arrow", "flash", "legends of tommorrow", "grimm", "limitless",
"izombie", "magicians", "person of interest", "daredevil");
foreach my $episode (@series) {
print "\033[0m"; # white
foreach my $fav (@favorites) {
if ($episode =~ /$fav/i) {
print "\033[93m"; # yellow
print "---> ";
last;
}
}
print $episode, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment