github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

allolex / Net-NPR-Query

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (2)
    • gh-pages
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A Perl module for dealing with requests to and responses from the NPR API (http://www.npr.org/api/index) — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Added search test which revealed a bug with the class' browser. Changes I 
had 
Damon Allen Davison (author)
Sat Jun 27 12:54:24 -0700 2009
commit  63875d234b32b4c968d3d98db788a955aa14e912
tree    d62dc0b7fe2155f921d27ec1650487d0414c7715
parent  86050dc7ad0ceee377a7245056d51af7c966b8f5
Net-NPR-Query /
name age
history
message
file Build.PL Loading commit data...
file README Thu Jun 25 08:05:25 -0700 2009 Initial commit [DAD-Damon Davison]
directory lib/ Sat Jun 27 12:54:24 -0700 2009 Added search test which revealed a bug with the... [Damon Allen Davison]
directory t/ Sat Jun 27 12:54:24 -0700 2009 Added search test which revealed a bug with the... [Damon Allen Davison]
README
NAME
    NPR::Query - Query National Public Radio's NPR API service for text and
    multimedia content.

SYNOPSIS
        use NPR::Query;

        my $term = shift;

        my $apikey = "API_KEY_STRING_PROVIDED_BY_NPR";

        my $npr = NPR::Query->new(apikey => $apikey);

        my $results = $npr->search("$term");

        $npr->print_stories($results);

DESCRIPTION
        National Public Radio is the US equivalent of the BBC. In 2008, they
        opened up their site content using a web API that allows access to nearly
        all of their content going back to 1995. People who want to use the API
        are required to obtain their own API key, which can be applied for here:
        L<<a href="http://www.npr.org/api/index">http://www.npr.org/api/index</a>>.

METHODS
    new
                    Returns an NPR::Query object. Requires the API KEY passed in a hash
                    argument.

                    my $npr -> NPR::Query->new(apikey => $apikey)

    uri
                        Returns the NPR API URI.

    search
                        Requires a search term passed as a scalar argument, returns an array reference.

    list
                        Requires an NPR list ID, returns an array reference.

    query
                        Requires a query URI, returns an array reference. Use the method L<build_query()> to build your 
                        query.

    build_query
                    Returns an NPR API string to give to the browser object.

                        $npr->build_query(value => "Perl");
                        $npr->build_query(type => "list", value => "2");

                        It requires at a minimum a "value" argument in the form value => "ID|SEARCH_TERM". 
                        The default query type is 'query', the dispatcher NPR uses for searches. If you require 
                        a list, then specify type => 'list'.

    validate_fields
                    Like the name says, this validates a field string against a list of valid
                    NPR API data fields.

    fields      Returns a list of valid NPR result fields.

    field_defaults
                        Returns a comma-separated string of default values for the NPR API to output.

    apikey
                        Returns your NPR API key.

    format      Returns the desired format for NPR API output.

    change_agent
                        Sets the browser user agent string.

    browser
                        Returns the C<<WWW::Mechanize>> browser object.

    print_stories
                        Provided the output from search(), query() or list(), this method prints out a basic summary of 
                        the stories.

TODO
        Pretty much everything really. Especially tests.

COPYRIGHT
        Copyright (C) 2009 Damon Allen Davison. All rights reserved.

AUTHOR
        Damon Allen Davison <allolex@gmail.com>

LICENCE
    This library is free software, you can redistribute it and/or modify it
    under the same terms as Perl itself.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server