Home
Home

Perl Module WebService::Viddler on CPAN

May 31 10

Perl Module WebService::Viddler on CPAN

Paul Weinstein

Back in March I outlined an idea
for a Perl module for accessing the video service Viddler
. As I
noted, at the time, while there was plenty of support for the Viddler
Application Programming Interface
via PHP, the support for Perl was
quite anemic.

To help rectify the situation, in my
“copious” free time I’ve been working on an Perl module that
wraps around Viddler’s API. The goal being to provide a quick method
for integrating Perl-based applications with Viddler.

Today, I’m happy to announce the first working release of my effort, WebService::Viddler, which can be found at
CPAN (Comprehensive Perl Archive Network).

As I mentioned, at the heart of things,
WebService::Viddler is an object-oriented encapsulation of the
Viddler video platform providing a Perl specific focus for access via their public API, which
itself is documented at:
http://developers.viddler.com/documentation/api/

Currently this module is, at best, beta quality code and only
supports version 1 of the Viddler API. Moreover, while it handles most of the
v1 API methods, it currently lacks support for the two commenting
related methods, videos-comments-add and videos-comments-remove (a
more complete To Do list can be found in the provided README file.

Of course the advantage of the module is that it makes including
Viddler in a Perl-based application, dead simple:

#!/usr/bin/perl -T
use strict;
use warnings;
use WebService::Viddler;
use Data::Dumper;
# Create our object and establish a session
my $videos = new WebService::Viddler(
apiKey => '123456ABCDEF',
username => $username,
password => $password,
);
# Get and print the API version is use
print "API Version: " .$videos->api_getInfo(). "\n";
# Upload a video providing required information such as the
# title, tag and description
$videos->videos_upload(
"Moon",
"Moon",
"A little video clip of...",
"0",
"/home/pdw/temp/Moon.mp4",
""
);
# Get the details of the given video and
# use Data::Dumper help print out the values in the list results
print Dumper( $videos->videos_getDetailsByUrl(
"http://www.viddler.com/explore/pdweinstein/videos/3/" ));
# Get a list of videos by the given tag and
# use Dumper to help print out the values in the list results
print Dumper( $videos->videos_getByTag( "moon" ));

Questions, bugs and code suggestions are of course welcomed!