WWW::TMDB::API - TMDb API (http://api.themoviedb.org) client
Version 0.04
use WWW::TMDB::API; # The constructor has 2 parameters - the api_key and the optional LWP::UserAgent object, ua. my $tmdb_client = WWW::TMDB::API->new( 'api_key' => 'your tmdb api key' ); # Retrieve information about the person with ID == 287 $tmdb_client->person->info( ID => 287 ); # Searches the themoviedb.org database for an actor, actress or production member with name 'Brad+Pitt' $tmdb_client->person->search( query => 'Brad+Pitt' ); # Searches the themoviedb.org database for an actor, actress or production member with name 'Brad' $tmdb_client->person->search( query => 'Brad' ); # Determines the last movie created in the themoviedb.org database. $tmdb_client->movie->latest();
This module implements version 3 of the TMDb API. See http://help.themoviedb.org/kb/api/about-3 for the documentation. The module uses the same parameter names used by the API. The method names have been slightly changed. Here's the mapping of the method names used by this this module and the corresponding method names in the TMDb API:
TMDB API WWW::TMDB::API ---------------------- ------------------- Search Movies search/movie movie->search() Search People search/person person->search() Movie Info movie/[TMDb ID] movie->info() Movie Alternative Titles movie/[TMDb ID]/alternative_titles movie->alternative_titles() Movie Casts movie/[TMDb ID]/casts movie->casts() Movie Images movie/[TMDb ID]/images movie->images() Movie Keywords movie/[TMDb ID]/keywords movie->keywords() Movie Release Info movie/[TMDb ID]/releases movie->releases() Movie Trailers movie/[TMDb ID]/trailers movie->trailers() Movie Translations movie/[TMDb ID]/translations movie->translations() Person Info person/[TMDb ID]/info person->info() Person Credits person/[TMDb ID]/credits person->credits() Person Images person/[TMDb ID]/images person->images() Latest Movie latest/movie movie->latest()
The API requires an API key which can be generated from http://api.themoviedb.org. This module converts the API output to Perl data structure using the module JSON. This module does not support update the method, Movie Add Rating.
Returns a new instance of the WWW::TMDB::API class.
api_key
Required. This is the TMDb API key. Go to the http://api.themoviedb.org to signup and generate an API key.
ua
Optional. The LWP::UserAgent used to communicate with the TMDb server.
my $tmdb_client = WWW::TMDB::API->new( 'api_key' => 'your tmdb api key' ); require LWP::UserAgent; $ua = LWP::UserAgent->new( 'agent' => "Perl-WWW-TMDB-API", ); my $tmdb_client = WWW::TMDB::API->new( 'api_key' => 'your tmdb api key', 'ua' => $ua );
Searches for movies.
query
Required. This is the search text. The query can include the year the movie was released (e.g. Transformers+2007) to narrow the search results.
page
Optional. Use this parameter to iterate through the search results. Search results that exceed 20 items are paginated.
language
Optional. This limits the result to items tagged with the specified language. The expected value is a ISO 639-1 code.
include_adult
Optional. [true/false, defaults to false if unspecified]. Set this to true to include adult items in the search results.
Searches for actors, actresses, or production members.
Required. This is the search text.
$result = $api->person->search( 'query' => 'Newman' );
Retrieves basic information about a movie. Building image urls from the file_paths returned by this method is discussed in the document http://help.themoviedb.org/kb/api/configuration.
ID
Required. The TMDb ID of the movie.
$result = $api->movie->info( ID => 903 );
Retrieves a movie's alternative titles.
country
Optional. This limits the result to items tagged with the specified country. The expected value is a ISO 3166-1 code.
$result = $api->movie->alternative_titles( ID => 903 ); $result = $api->movie->alternative_titles( ID => 903, 'language' => 'fr' );
Retrieves a movie's cast information.
$result = $api->movie->casts( ID => 903 );
Retrieves all of the images for a particular movie. Building image urls from the file_paths returned by this method is discussed in the document: http://help.themoviedb.org/kb/api/configuration
$result = $api->movie->images( ID => 903 ); $result = $api->movie->images( ID => 903, 'language' => 'en' );
Retrieves the keywords for a movie.
$result = $api->movie->keywords( ID => 903 );
Retrieves release and certification data for a specific movie.
$result = $api->movie->releases( ID => 903 );
Retrieves the trailers for a movie.
$result = $api->movie->trailers( ID => 903 );
Retrieves the list of translations for a movie.
$result = $api->movie->translations( ID => 903 );
Retrieves basic information about a person. Building image urls from the file_paths returned by this method is discussed in the document: http://help.themoviedb.org/kb/api/configuration
Required. The TMDb ID of the person.
$result = $api->person->info( ID => 3636 );
Retrieves the movies that have cast or crew credits for a person.
$result = $api->person->credits( ID => 3636 );
Retrieves all the profile images of the person. Building image urls from the file_paths returned by this method is discussed in the document: http://help.themoviedb.org/kb/api/configuration]
$result = $api->person->images( ID => 3636 );
Returns the newest movie created in the themoviedb.org database.
Maria Celina Baratang, <maria at zambale.com>
<maria at zambale.com>
Please report any bugs or feature requests to bug-www-tmdb-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-TMDB-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-www-tmdb-api at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WWW::TMDB::API
You can also look for information at:
TMDb The open movie database
http://themoviedb.org/
themoviedb.org API Documentation
http://api.themoviedb.org/ http://help.themoviedb.org/kb/api/about-3
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-TMDB-API
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WWW-TMDB-API
CPAN Ratings
http://cpanratings.perl.org/d/WWW-TMDB-API
Search CPAN
http://search.cpan.org/dist/WWW-TMDB-API/
Copyright 2012 Maria Celina Baratang.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
1 POD Error
The following errors were encountered while parsing the POD:
=back doesn't take any parameters, but you said =back $result = $api->movie->search( 'query' => 'Cool Hand' );
To install WWW::TMDB::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::TMDB::API
CPAN shell
perl -MCPAN -e shell install WWW::TMDB::API
For more information on module installation, please visit the detailed CPAN module installation guide.