The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::MovieReviews::NYT - Interface to NewYorkTimes Movie Reviews API.

VERSION

Version 0.04

DESCRIPTION

With the Movie Reviews API, you can search New York Times movie reviews by keyword and get lists of NYT Critics' Picks.Usage is limited to 5000 requests per day (rate limits are subject to change). Currently supports version v2. As of now it only gets result in XML format.

The Movie Reviews service uses a RESTful style. Four request types are available:

    +-----+----------------------------------------------+
    | No. | Type                                         |
    +-----+----------------------------------------------+
    |  1  | Search reviews by keyword.                   |
    |  2  | Get lists of reviews and NYT Critics' Picks. |
    |  3  | Get reviews by reviewer.                     |
    |  4  | Get information about reviewers.             |
    +-----+----------------------------------------------+

CONSTRUCTOR

The constructor expects your application API, which you can get it for FREE from The New York Times Developer site. You need to create an account first with them. You only need to pick any username of your choice and password to get it started.Once you have the account setup you can then request for API Key and accept their Terms and Condition for usage. Here is the link for Registration: https://myaccount.nytimes.com/register

    use strict; use warnings;
    use WWW::MovieReviews::NYT;

    my $api_key = 'Your_API_Key';
    my $movie   = WWW::MovieReviews::NYT->new($api_key);

METHODS

by_keyword()

Search the reviews by given keyword. Possible parameters listed below:

    +------------------+-----------------------------------------+------------------------+
    | Name             | Description                             | Example                |
    +------------------+-----------------------------------------+------------------------+
    | query            | Search keyword; matches movie title.    | 'wild+west'            |
    | critics-pick     | Limits by NYT Critics Picks status.     | Y | N                  |
    | thausand-best    | Limits by Best 1,000 Movies status.     | Y | N                  |
    | dvd              | Limits by format.                       | Y | N                  |
    | reviewer         | Limits by a specific NYT critic.        | monohla.dargis         |
    | publication-date | Limits by date or range of dates.       | YYYY-MM-DD;YYYY-MM-DD  |
    | opening-date     | Limits by date or range of dates.       | YYYY-MM-DD;YYYY-MM-DD  |
    | offset           | Sets the starting point of the results. | Multiple of 20.        |
    | order            | Sets the sort order of the results.     | by-title               |
    |                  |                                         | or by-publication-date |
    |                  |                                         | or by-opening-date     |
    |                  |                                         | or by-dvd-release-date |
    +------------------+-----------------------------------------+------------------------+

You can specify up to three search parameters (order, limit and offset do not count toward this maximum, but query does).

    use strict; use warnings;
    use WWW::MovieReviews::NYT;

    my $api_key = 'Your_API_Key';
    my $movie   = WWW::MovieReviews::NYT->new($api_key);
    print $movie->by_keyword({'query' => 'wild+west'});

by_reviews_critics()

Search by reviews and NYT critics. Possible parameters listed below:

    +---------------+-----------------------------------------+-------------------------+
    | Name          | Description                             | Example                 |
    +---------------+-----------------------------------------+-------------------------+
    | resource-type | All reviews or NYT Critics Picks.       | all | picks | dvd-picks |
    | offset        | Sets the starting point of the results. | Multiple of 20.         |
    | order         | Sets the sort order of the results.     | by-title                |
    |               |                                         | or by-publication-date  |
    |               |                                         | or by-opening-date      |
    |               |                                         | or by-dvd-release-date  |
    +---------------+-----------------------------------------+-------------------------+

    use strict; use warnings;
    use WWW::MovieReviews::NYT;

    my $api_key = 'Your_API_Key';
    my $movie   = WWW::MovieReviews::NYT->new($api_key);
    print $movie->by_reviews_critics({'resource-type' => 'all', 'order' => 'by-title'});

by_reviewer()

Search by reviewer. Possible parameters listed below:

    +---------------+-----------------------------------------+------------------------+
    | Name          | Description                             | Example                |
    +---------------+-----------------------------------------+------------------------+
    | reviewer-name | The name of the Times reviewer.         | manohla-dargis         |
    | critics-pick  | Limits by NYT Critics Picks status.     | Y | N                  |
    | offset        | Sets the starting point of the results. | Multiple of 20.        |
    | order         | Sets the sort order of the results.     | by-title               |
    |               |                                         | or by-publication-date |
    |               |                                         | or by-opening-date     |
    |               |                                         | or by-dvd-release-date |
    +---------------+-----------------------------------------+------------------------+

    use strict; use warnings;
    use WWW::MovieReviews::NYT;

    my $api_key = 'Your_API_Key';
    my $movie   = WWW::MovieReviews::NYT->new($api_key);
    print $movie->by_reviewer({'reviewer-name' => 'manohla-dargis',
                               'critics-pick'  => 'Y',
                               'order'         => 'by-title'});

get_reviewer_details()

Get reviewer details. Possible parameters listed below:

    +---------------+--------------------------------------------+-----------------------------+
    | Name          | Description                                | Example                     |
    +---------------+--------------------------------------------+-----------------------------+
    | resource-type | A set of reviewers or a specific reviewer. | all | full-time | part-time |
    |               |                                            | reviewer | [reviewer-name]  |
    +---------------+--------------------------------------------+-----------------------------+

    use strict; use warnings;
    use WWW::MovieReviews::NYT;

    my $api_key = 'Your_API_Key';
    my $movie   = WWW::MovieReviews::NYT->new($api_key);
    print $movie->get_reviewer_details('all');

AUTHOR

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS

Please report any bugs or feature requests to bug-www-moviereviews-nyt at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-MovieReviews-NYT. I will be notified and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc WWW::MovieReviews::NYT

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2011 Mohammad S Anwar.

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.

DISCLAIMER

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.