--- /dev/null
+Revision history for Perl extension WWW::Offliberty.
+
+0.001 Sat 28 Sep 23:48:00 EEST 2013
+ - Initial release
--- /dev/null
+Changes
+Makefile.PL
+MANIFEST
+README
+t/00-load.t
+t/50-network.t
+lib/WWW/Offliberty.pm
--- /dev/null
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'WWW::Offliberty',
+ VERSION_FROM => 'lib/WWW/Offliberty.pm',
+ ABSTRACT_FROM => 'lib/WWW/Offliberty.pm',
+ AUTHOR => 'Marius Gavrilescu <marius@ieval.ro>',
+ MIN_PERL_VERSION => '5.14.0',
+ LICENSE => 'perl',
+ SIGN => 1,
+ PREREQ_PM => {
+ HTML::TreeBuilder => 0,
+ LWP::UserAgent => 0,
+ },
+ META_ADD => {
+ dynamic_config => 0,
+ repository => 'http://git.ieval.ro/?p=www-offliberty.git'
+ }
+);
--- /dev/null
+WWW-Offliberty version 0.001
+============================
+
+WWW::Offliberty is a simple interface to the offliberty.com download service.
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+DEPENDENCIES
+
+This module requires these other modules and libraries:
+
+ * HTML::TreeBuilder
+ * LWP::UserAgent
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2013 by Marius Gavrilescu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.18.1 or,
+at your option, any later version of Perl 5 you may have available.
+
+
--- /dev/null
+package WWW::Offliberty;
+
+use 5.014;
+use strict;
+use warnings;
+use parent qw/Exporter/;
+our $VERSION = '0.001';
+our @EXPORT_OK = qw/off/;
+
+use HTML::TreeBuilder;
+use LWP::UserAgent;
+
+my $ua = LWP::UserAgent->new;
+
+sub off{
+ my ($url, @params) = @_;
+ my $content = $ua->post("http://offliberty.com/off.php", {track => $url, @params})->decoded_content;
+ my $root = HTML::TreeBuilder->new_from_content($content);
+ map { $_->attr('href') } $root->look_down(qw/_tag a class download/);
+}
+
+1;
+__END__
+
+=head1 NAME
+
+WWW::Offliberty - interface to offliberty.com download service
+
+=head1 SYNOPSIS
+
+ use WWW::Offliberty qw/off/;
+ my @links = off 'http://youtube.com/watch?v=something', video_file => 1;
+
+=head1 DESCRIPTION
+
+WWW::Offliberty is a simple interface to the offliberty.com download service.
+
+It exports a single function: B<off>(I<url>, [I<argument> => value...]).
+This function that returns a list of download links,
+as returned by the service.
+
+=head1 SEE ALSO
+
+L<http://offliberty.com>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2013 by Marius Gavrilescu
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.18.1 or,
+at your option, any later version of Perl 5 you may have available.
+
+
+=cut
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+BEGIN { use_ok('WWW::Offliberty') };
--- /dev/null
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+
+use Test::More;
+use WWW::Offliberty qw/off/;
+
+if ($ENV{NETWORK_TEST}) {
+ plan tests => 2;
+
+ my @results;
+
+ @results = off "http://youtube.com/watch?v=Tj75Arhq5ho";
+ is @results, 1, 'youtube';
+
+ @results = off "http://youtube.com/watch?v=Tj75Arhq5ho", video_file => 1;
+ is @results, 2, 'youtube, video_file => 1';
+} else {
+ plan skip_all => '$ENV{NETWORK_TEST} not true';
+}