NAME
WWW::NHKProgram::API - API client for NHK program API
SYNOPSIS
use
WWW::NHKProgram::API;
my
$client
= WWW::NHKProgram::API->new(
api_key
=>
'__YOUR_API_KEY__'
);
# Get program list
my
$program_list
=
$client
->list({
area
=> 130,
service
=>
'g1'
,
date
=>
'2014-02-02'
,
});
# Get program list by genre
my
$program_genre
=
$client
->genre({
area
=> 130,
service
=>
'g1'
,
genre
=>
'0000'
,
date
=>
'2014-02-02'
,
});
# Get program information
my
$program_info
=
$client
->info({
area
=> 130,
service
=>
'g1'
,
id
=>
'2014020334199'
,
});
# Get information of program that is on air now
my
$program_now
=
$client
->now_on_air({
area
=> 130,
service
=>
'g1'
,
});
DESCRIPTION
WWW::NHKProgram::API is the API client for NHK program API.
Please refer http://api-portal.nhk.or.jp if you want to get information about NHK program API.
METHODS
WWW::NHKProgram::API->new();
Constructor. You must give API_KEY through this method.
e.g.
my
$client
= WWW::NHKProgram::API->new(
api_key
=>
'__YOUR_API_KEY__'
,
# <= MUST!
);
$client->list()
Get program list.
my
$program_list
=
$client
->list({
area
=> 130,
service
=>
'g1'
,
date
=>
'2014-02-04'
,
});
And following the same;
my
$program_list
=
$client
->list({
area
=>
'東京'
,
service
=>
'NHK総合1'
,
date
=>
'2014-02-04'
,
});
You can specify Japanese area name and service name as arguments. If you want to know more details, please refer to the following;
$client->genre()
Get program list by genre.
my
$genre_list
=
$client
->genre({
area
=> 130,
service
=>
'g1'
,
genre
=>
'0000'
,
date
=>
'2014-02-04'
,
});
Yes! you can also specify following;
my
$genre_list
=
$client
->genre({
area
=>
'東京'
,
service
=>
'NHK総合1'
,
genre
=>
'定時・総合'
,
date
=>
'2014-02-04'
,
});
$client->info()
Get information of program.
my
$program_info
=
$client
->info({
area
=> 130,
service
=>
'g1'
,
id
=>
'2014020402027'
,
});
Also;
my
$program_info
=
$client
->info({
area
=>
'東京'
,
service
=>
'NHK総合1'
,
id
=>
'2014020402027'
,
});
$client->now_on_air()
Get information of program that is on air now.
my
$program_now
=
$client
->now_on_air({
area
=> 130,
service
=>
'g1'
,
});
Yes,
my
$program_now
=
$client
->now_on_air({
area
=>
'東京'
,
service
=>
'NHK総合1'
,
});
$client->list_raw()
$client->genre_raw()
$client->info_raw()
$client->now_on_air_raw()
Returns raw JSON response of each API.
FOR DEVELOPERS
Tests which are calling web API directly in xt/webapi. If you want to run these tests, please execute like so;
$ NHK_PROGRAM_API_KEY=__YOUR_API_KEY__ prove xt/webapi
LICENSE
Copyright (C) moznion.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
moznion <moznion@gmail.com>