NAME
WWW::YouTube::VideoURI - a module to determine the URI of a Flash Video file on YouTube.com
SYNOPSIS
!/usr/bin/perl
use WWW::YouTube::VideoURI;
use LWP::Simple;
my $yt = new WWW::YouTube::VideoURI;
my $uri = 'http://www.youtube.com/watch?v=FMkJVXi7Rp8';
my $video_uri = $yt->get_video_uri($uri);
getstore($video_uri, "ze_frank.flv");
DESCRIPTION
http://www.youtube.com is a wonderful service, but sometimes it is not possible or desirable to watch the videos it offers online. Unlike Google Video, YouTube does not offer a facility to download the videos for offline viewing.
This module takes a standard YouTube.com URI and determines the URI of the FLV file for a given video, which can then be retrieved for later viewing.
USAGE
Apart from the constructor (which has no arguments) there is only one method, get_video_uri
, which accepts a string containing a YouTube URI. This method does minimal validation of the URI - it only requires that there be a v
parameter in the query string. It then queries the YouTube.com server for the other parameter required to generate a valid video URI. You can then use another module such as LWP to retrieve this video.
If there is a problem with the URI supplied, or a network or HTTP error, then this module will croak().
WARNING
WWW::YouTube::VideoURI
is not a "screen scraper" as such since it does no HTML parsing: it merely scrutinises the HTTP headers returned by the YouTube.com server. However, it is possible that the system used may be changed by YouTube.com at any time and with no warning, so at some time in the future, this module may stop functioning.
LICENSE AND COPYRIGHT
Copyright (c) Gavin Brown. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.