Video::NRK::Cache::ProgramId - NRK on-demand "PRF" program ID
version 3.01
$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
Utility class for discovering the NRK video on demand "PRF" program ID.
When constructing a Video::NRK::Cache::ProgramId object, new() accepts the following parameters:
new()
Calls the parse() method with the value provided. Optional.
parse()
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.
https://psapi.nrk.no
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.
Video::NRK::Cache::ProgramId provides the following methods:
$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).
$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_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.
psapi_base
$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.
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.
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.
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.
To install Video::NRK::Cache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Video::NRK::Cache
CPAN shell
perl -MCPAN -e shell install Video::NRK::Cache
For more information on module installation, please visit the detailed CPAN module installation guide.