NAME

Video::NRK::Cache::ProgramId - NRK on-demand "PRF" program ID

VERSION

version 3.01

SYNOPSIS

$program_id = Video::NRK::Cache::ProgramId->new( parse =>
  'https://tv.nrk.no/serie/monsen-paa-villspor/sesong/1/episode/2',
);
say $program_id->id;
  # MUHU10000214

$program_id = Video::NRK::Cache::ProgramId->new;
$program_id->parse( 'DVFJ64001010' );
say $program_id->url;
  # https://tv.nrk.no/program/DVFJ64001010

DESCRIPTION

Utility class for discovering the NRK video on demand "PRF" program ID.

PARAMETERS

When constructing a Video::NRK::Cache::ProgramId object, new() accepts the following parameters:

parse

Calls the parse() method with the value provided. Optional.

psapi_base

The NRK PSAPI base URL to use. If not provided, by default https://psapi.nrk.no will be attempted first, before at attempt is undertaken to determine the correct API base from NRK's web site. Optional.

ua

The HTTP::Tiny object to use for accessing NRK's web site. If not provided, a new HTTP::Tiny instance will be created using default settings. Optional.

METHODS

Video::NRK::Cache::ProgramId provides the following methods:

id
$id = $program_id->id;

Return the NRK video on demand "PRF" program ID determined by parse(). This is usually a string of four letters and eight digits (e. g. DVFJ64001010).

parse
$program_id->parse( $string );

Parses the provided string and attempts to determine the NRK video on demand "PRF" program ID and an URL from it. Accepts a program ID or an URL.

psapi_base
$psapi_url = $program_id->psapi_base;

Return the NRK PSAPI base URL. If the NRK web site has been accessed and has been found to provide the PSAPI base, that is the value returned by this method; otherwise, the value of the psapi_base parameter is returned.

url
$url = $program_id->url;

Return a URL for the video on demand program identified. NRK content may be accessible through more than one URL, and the value returned by this method is is not necessarily the canonical one.

LIMITATIONS

This software's OOP API is new and still evolving. Additionally, this software uses perlclass, which is an experimental feature. The class structure and API will likely be redesigned in future, once the implementation of Corinna in Perl is more complete.

AUTHOR

Arne Johannessen <ajnn@cpan.org>

If you contact me by email, please make sure you include the word "Perl" in your subject header to help beat the spam filters.

COPYRIGHT AND LICENSE

Arne Johannessen has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.

Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.