N
Nathan Childress
There's a popular (and very nice) Perl program called "Showtimes" that
grabs movie listings off of the internet and converts them to Palm PDA
files. It's currently unsupported, and its link to IMDB doesn't work
anymore. I don't program in Perl, but looking through the code I
think I found the problem lines, although I have no idea how to fix
them. The problem (I think) is that IMDB used to have links to movies
in the form of "http://www.imdb.com/title?1234", but now it uses
"http://www.imdb.com/title/tt1234". Also, the plot summary used to be
found at "http://us.imdb.com/Plot?1234", whereas now it's at
"http://us.imdb.com/title/tt1234/plotsummary". Here is the the
relevant portion of the old code:
==========================
# This URL still works, I think
my $URL = 'http://us.imdb.com/Tfuzzy?title=' . $safetitle .
"&type=$st&sort=chrono&tv=off";
my $content = grabpage ( $URL, 1 );
last SEARCHTYPE unless ( defined ( $content ));
# Search for the first entry in the Movies section.
if (( $content =~ s|^.*?<A NAME=\"mov\">||s ) &&
( $content =~ m|<A HREF=\"/Title\?(.*?)\">(.*?)</A>| ))
{
$number = $1;
$match = $2;
# Grab the main details page.
$content = grabpage ( "http://us.imdb.com/Title/$number", 1 );
last SEARCHTYPE unless ( defined ( $content ));
print " [$match]";
$EMCache { Movies }{ $title }{ Data } .= "$match";
$EMCache { Movies }{ $title }{ LastAccess } = time ();
$EMCache { Movies }{ $title }{ OnDevice } = 0;
# Check for a plot summary ...
if ( $content =~ /<B CLASS=\"ch\">Plot Summary: / )
{
$content = grabpage ( "http://us.imdb.com/Plot?$number", 1 );
last SEARCHTYPE unless ( defined ( $content ));
if ( $content =~ /<P CLASS=\"plotpar\">(.*?)<\/P>/s )
{
my $plot = $1;
$plot =~ s/<.*?>//sg;
$plot =~ tr/\012/ /;
$EMCache { Movies }{ $title }{ Data } .= "\012$plot";
if ( $content =~ /Summary written by <.*?> (.*?)<\/A><\/P>/s )
{
my $cred = $1;
$EMCache { Movies }{ $title }{ Data } .= "\012Summary by
$cred";
}
$found = 1;
}
}
# ... or a plot outline.
elsif ( $content =~ /<B CLASS=\"ch\">Plot Outline: <\/B>(.*?)[
\(]+</s )
{
my $outline = $1;
$EMCache { Movies }{ $title }{ Data } .= "\012$outline";
$found = 1;
}
last SEARCHTYPE;
}
}
==========================
The full original program (highly recommended) can be found at
http://showtimes.jrray.org/. I have no idea how to use Perl to fix
the code, but I assume it would be useful to a lot of people. I just
thought that if anyone was interested, this might not be so hard to
fix.
grabs movie listings off of the internet and converts them to Palm PDA
files. It's currently unsupported, and its link to IMDB doesn't work
anymore. I don't program in Perl, but looking through the code I
think I found the problem lines, although I have no idea how to fix
them. The problem (I think) is that IMDB used to have links to movies
in the form of "http://www.imdb.com/title?1234", but now it uses
"http://www.imdb.com/title/tt1234". Also, the plot summary used to be
found at "http://us.imdb.com/Plot?1234", whereas now it's at
"http://us.imdb.com/title/tt1234/plotsummary". Here is the the
relevant portion of the old code:
==========================
# This URL still works, I think
my $URL = 'http://us.imdb.com/Tfuzzy?title=' . $safetitle .
"&type=$st&sort=chrono&tv=off";
my $content = grabpage ( $URL, 1 );
last SEARCHTYPE unless ( defined ( $content ));
# Search for the first entry in the Movies section.
if (( $content =~ s|^.*?<A NAME=\"mov\">||s ) &&
( $content =~ m|<A HREF=\"/Title\?(.*?)\">(.*?)</A>| ))
{
$number = $1;
$match = $2;
# Grab the main details page.
$content = grabpage ( "http://us.imdb.com/Title/$number", 1 );
last SEARCHTYPE unless ( defined ( $content ));
print " [$match]";
$EMCache { Movies }{ $title }{ Data } .= "$match";
$EMCache { Movies }{ $title }{ LastAccess } = time ();
$EMCache { Movies }{ $title }{ OnDevice } = 0;
# Check for a plot summary ...
if ( $content =~ /<B CLASS=\"ch\">Plot Summary: / )
{
$content = grabpage ( "http://us.imdb.com/Plot?$number", 1 );
last SEARCHTYPE unless ( defined ( $content ));
if ( $content =~ /<P CLASS=\"plotpar\">(.*?)<\/P>/s )
{
my $plot = $1;
$plot =~ s/<.*?>//sg;
$plot =~ tr/\012/ /;
$EMCache { Movies }{ $title }{ Data } .= "\012$plot";
if ( $content =~ /Summary written by <.*?> (.*?)<\/A><\/P>/s )
{
my $cred = $1;
$EMCache { Movies }{ $title }{ Data } .= "\012Summary by
$cred";
}
$found = 1;
}
}
# ... or a plot outline.
elsif ( $content =~ /<B CLASS=\"ch\">Plot Outline: <\/B>(.*?)[
\(]+</s )
{
my $outline = $1;
$EMCache { Movies }{ $title }{ Data } .= "\012$outline";
$found = 1;
}
last SEARCHTYPE;
}
}
==========================
The full original program (highly recommended) can be found at
http://showtimes.jrray.org/. I have no idea how to use Perl to fix
the code, but I assume it would be useful to a lot of people. I just
thought that if anyone was interested, this might not be so hard to
fix.