Perl Basics
Introduction to Perl
FAQ's
CGI
Regular Expressions

PC Overview
Cool Stuff
My Modules
Success Stories
Links
Perl in the News
Logos

PC Internals
About
Contact
Handy Logos
What's new

IMDB.pm - Internet Movie Database

See also modules
P-friendly

[ home ] - [ search ] - [ sitemap ]


Purpose

Retrieve information about DVD's and media from IMDB (Internet Movie Database).

Usage

use IMDB;

$OBJ = IMDB->new( debug => 1 );

%HASH = $OBJ->query('title' => 'YOUR TITLE');

First example «stark trek», shown below, demonstrates the behaviour of a non-unique result. Your result hash will be expanded with a "best result list", started with the best guess with number #1. Second example shows a simple «first try match» you get e.g. with «pulp fiction».

use IMDB;
 
$imdb = IMDB->new();

%res_1 = $imdb->query('title' => 'star trek');
print "-> $_ = $res_1{$_}\n" foreach sort keys %res_1;
 
%res_2 = $imdb->query('title' => 'pulp fiction');
print "-> $_ = $res_2{$_}\n" foreach sort keys %res_2;

Download source code of IMDB.pm

Verbose Output

[ IMDB ] IMDB V0.80.07
[ IMDB ] title = star trek
[ IMDB ] N1002: Expanding information for title 'star trek'
[ IMDB ] N1000: http code = 200 -> http://us.imdb.com/Find?select=all&for=star+trek
[ IMDB ] N1003: Comparing 'IMDb name and title search' with 'star trek'...
[ IMDB ] N1008: Not matched.
[ IMDB ] N1005: Received a list from IMDB...
[ IMDB ] N1011: 0060028	"Star Trek" (1966)
[ IMDB ] N1011: 0092455	"Star Trek: The Next Generation" (1987)
[ IMDB ] N1011: 0112178	"Star Trek: Voyager" (1995)
[ IMDB ] N1011: 0102975	Star Trek VI: The Undiscovered Country (1991)
[ IMDB ] N1011: 0117731	Star Trek: First Contact (1996)
[ IMDB ] N1011: 0253754	Star Trek: Nemesis (2002)
[ IMDB ] N1011: 0244365	"Enterprise" (2001)
[ IMDB ] N1004: Check for genre on follow-up page...
[ IMDB ] N1000: http code = 200 -> http://us.imdb.com/Title?0060028
[ IMDB ] N1010: Sci-Fi  / Adventure  
--> best_ref_1 = 0060028
--> best_ref_2 = 0092455
--> best_ref_3 = 0112178
--> best_ref_4 = 0102975
--> best_ref_5 = 0117731
--> best_ref_6 = 0253754
--> best_ref_7 = 0244365
--> best_title_1 = "Star Trek" (1966)
--> best_title_2 = "Star Trek: The Next Generation" (1987)
--> best_title_3 = "Star Trek: Voyager" (1995)
--> best_title_4 = Star Trek VI: The Undiscovered Country (1991)
--> best_title_5 = Star Trek: First Contact (1996)
--> best_title_6 = Star Trek: Nemesis (2002)
--> best_title_7 = "Enterprise" (2001)
--> count = 62
--> directed_by = David Alexander (I)  
--> genre = Sci-Fi  / Adventure  
--> imdb_ref = 0060028
--> imdb_title = "Star Trek" (1966)
--> rc = 0
[ IMDB ] title = pulp fiction
[ IMDB ] N1002: Expanding information for title 'pulp fiction'
[ IMDB ] N1000: http code = 200 -> http://us.imdb.com/Find?select=all&for=pulp+fiction
[ IMDB ] N1003: Comparing 'Pulp Fiction (1994)' with 'pulp fiction'...
[ IMDB ] N1009: Matched at first try: 0110912
--> count = 1
--> directed_by = Quentin Tarantino  
--> genre = Crime  / Thriller  / Action  / Drama  
--> imdb_ref = 0110912
--> imdb_title = Pulp Fiction (1994)
--> rc = 0


Find more related modules on
- http://directory.google.com/Top/Computers/Programming/Languages/Perl/Modules/
- http://www.metaxearch.com/en/odp/Computers/Programming/Languages/Perl/Modules

home - feedback - search

$Id: perlstyle.htm,v 1.3 2004/03/11 21:44:09 reto Exp $
© 1998-2004 reto :)