Robert Ginko > WWW-YouTube-Info-Simple-0.08 > WWW::YouTube::Info::Simple

Download:
WWW-YouTube-Info-Simple-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

WWW::YouTube::Info::Simple - simple interface to WWW::YouTube::Info

SYNOPSIS ^

Perhaps a little code snippet?

  #!/usr/bin/perl
  
  use strict;
  use warnings;
  
  use WWW::YouTube::Info::Simple;
  
  # id taken from YouTube video URL
  my $id = 'foobar';
  
  my $yt = WWW::YouTube::Info::Simple->new($id);
  
  # hash reference holds values gained via http://youtube.com/get_video_info?video_id=foobar
  my $info = $yt->get_info();
  # this is basically an inheritance to get_info() at WWW::YouTube::Info
  # $info->{title}          # e.g.: Foo+bar+-+%27Foobar%27
  # $info->{author}         # e.g.: foobar
  # $info->{keywords}       # e.g.: Foo%2Cbar%2CFoobar
  # $info->{length_seconds} # e.g.: 60
  # $info->{fmt_map}        # e.g.: 22%2F1280x720%2F9%2F0%2F115%2C35%2F854x480%2F9%2F0%2F115%2C34%2F640x360%2F9%2 ..
  # $info->{fmt_url_map}    # e.g.: 22%7Chttp%3A%2F%2Fv14.lscache1.c.youtube.com%2Fvideoplayback%3Fip%3D131.0.0.0 ..
  # $info->{fmt_stream_map} # e.g.: 22%7Chttp%3A%2F%2Fv14.lscache1.c.youtube.com%2Fvideoplayback%3Fip%3D131.0.0.0 ..
  
  # array reference holds values keywords
  my $keys = $yt->get_keywords();
  # $keys->[0] # e.g.: Foo
  # $keys->[1] # e.g.: bar
  # ..
  
  # hash reference holds values quality -> resolution
  my $res = $yt->get_resolution();
  # $res->{35} # e.g.: 854x480
  # $res->{22} # e.g.: 1280x720
  # ..
  
  # URL and masquerading decoded title
  my $title = $yt->get_title(); # e.g.: Foo bar - 'Foobar'
  
  # hash reference holds values quality -> url
  my $url = $yt->get_url();
  # $url->{35} e.g.: http://v14.lscache1.c.youtube.com/videoplayback?ip=131.0.0.0 ..
  # $url->{22} e.g.: http://v14.lscache1.c.youtube.com/videoplayback?ip=131.0.0.0 ..
  # ..
  
  # URL decoded RTMPE URL
  my $conn = $yt->get_conn(); # e.g.: rtmpe://cp59009.edgefcs.net/youtube?auth=daEcaboc8dvawbcbxazdobDcZajcDdgcfae ..
  
  # Remark:
  # You might want to check $info->{status} before further workout,
  # as some videos have copyright issues indicated, for instance, by
  # $info->{status} ne 'ok'.

DESCRIPTION ^

I guess its pretty much self-explanatory ..

METHODS ^

get_keywords

Returns undef if status ne 'ok'. Croaks if not available.

get_resolution

Returns undef if status ne 'ok'. Croaks if not available.

get_title

Returns undef if status ne 'ok'. Croaks if not available.

get_url

Returns undef if status ne 'ok'. Croaks if not available.

  use WWW::YouTube::Info::Simple;
  
  # id taken from YouTube video URL
  my $id = 'foobar';
  
  my $yt = WWW::YouTube::Info::Simple->new($id);
  
  # hash reference holds values quality -> url
  my $url = $yt->get_url();
  # $url->{35} e.g.: http://v14.lscache1.c.youtube.com/videoplayback?ip=131.0.0.0 ..
  # $url->{22} e.g.: http://v14.lscache1.c.youtube.com/videoplayback?ip=131.0.0.0 ..
  # ..

YouTube videos can be downloaded in given qualities by means of these URLs and the usual suspects (wget, ..).

get_conn

Returns undef if status ne 'ok'. Croaks if not available.

  use WWW::YouTube::Info::Simple;
  
  # id taken from YouTube video URL
  my $id = 'foobar';
  
  my $yt = WWW::YouTube::Info::Simple->new($id);
  
  # URL decoded RTMPE URL
  my $conn = $yt->get_conn(); # e.g.: rtmpe://cp59009.edgefcs.net/youtube?auth=daEcaboc8dvawbcbxazdobDcZajcDdgcfae ..

A YouTube RTMPE stream can be accessed via this URL and downloaded by means of the usual suspects (rtmpdump, ..). The URL looses its validity after approx. 30 seconds (experimental value). Gathering a fresh RTMPE URL regarding the same VIDEO_ID and the rtmpdump .. --resume capability might circumvent this inconvenience.

SEE ALSO ^

You might want to have a look at the ./examples folder within this distribution, or at WWW::YouTube::Info.

HINTS ^

Searching the internet regarding 'fmt_url_map', 'url_encoded_fmt_stream_map' and/or 'get_video_info' might gain hints/information to improve WWW::YouTube::Info and WWW::YouTube::Info::Simple as well.

BUGS ^

Please report bugs and/or feature requests to bug-WWW-YouTube-Info-Simple at rt.cpan.org, alternatively by means of the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-YouTube-Info-Simple.

AUTHOR ^

east <east@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2011 by east

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: