WWW::SVT::Play::Video, extract information about videos on SVT Play
use WWW::SVT::Play::Video; my $uri = 'http://www.svtplay.se/video/1014238/del-8'; my $svtp = WWW::SVT::Play::Video->new($uri); say $svtp->title; if ($svtp->has_hls) { say $svtp->stream(protocol => 'HLS')->url; }
Construct a WWW::SVT::Play::Video object by passing the URL to the video you're interested in. A second argument consisting of a hashref of options is reserved for future use.
$svtp->url
Returns the URL to the video's web page after it has been, postprocessed somewhat.
$svtp->stream( protocol => 'HLS' ) $svtp->stream( internal => 'ios' ) $svtp->stream( protocol => 'RTMP', bitrate => '1400') my $url = $svtp->stream( protocol => 'HLS' )->url if $svtp->has_hls;
Returns the stream object matching the given requirement (or undef if video does not have a matching stream). Takes either SVT Play internal playerType name (named parameter: internal), or the protocol name (named parameter: protocol).
Currently supported protocols: HLS, HDS and RTMP. If extracting RTMP, an optional bitrate parameter can be supplied. If this isn't supplied, a hash of bitrate url pairs is returned.
RTMP is deprecated and no longer in use by SVT Play. Support for this may be dropped in the future.
Returns a human readable title for the video.
Returns a filename suggestion for the video. If you give the optional type argument, you also get a file extension.
In list context, returns a list of available RTMP stream bitrates for the video. In scalar context, the highest available bitrate is returned.
Note: Currently, we only support listing bitrates for RTMP streams, since they are given to us directly in the JSON blob.
Returns a "guess" of what the format is, by trying to extract a file extension from the stream URL. Of course, the format depends on what bitrate you want, so you have to supply that.
In list context, returns a list of URLs to subtitles. In scalar context, returns the first URL in that list. If there are no subtitles available for this video, returns an empty list (in list context) or undef (in scalar context).
Returns the length of the video in seconds.
Copyright (c) 2012, 2013 - Olof Johansson <olof@cpan.org>
All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::SVT::Play::Video, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::SVT::Play::Video
CPAN shell
perl -MCPAN -e shell install WWW::SVT::Play::Video
For more information on module installation, please visit the detailed CPAN module installation guide.