]>
iEval git - www-offliberty.git/blob - lib/WWW/Offliberty.pm
f14c0d8f1d18916e9a24b1eafcad7547153e185a
1 package WWW
::Offliberty
;
6 use parent qw
/Exporter/;
7 our $VERSION = '1.000001';
8 our @EXPORT_OK = qw
/off/;
10 use constant OFF_URL
=> 'http://offliberty.com/off02.php';
12 use HTML
::TreeBuilder
;
15 our $http = HTTP
::Tiny
->new(agent
=> "WWW-Offliberty/$VERSION ", default_headers
=> {Referer
=> 'http://offliberty.com/'});
18 my ($url, @params) = @_;
19 my $ret = $http->post_form(OFF_URL
, {track
=> $url, @params});
20 die $ret->{reason
} unless $ret->{success
}; ## no critic (RequireCarping)
21 my $root = HTML
::TreeBuilder
->new_from_content($ret->{content
});
22 map { $_->attr('href') } $root->look_down(qw
/_tag a class download/);
30 WWW::Offliberty - interface to offliberty.com download service
34 use WWW::Offliberty qw/off/;
35 my @links = off 'http://youtube.com/watch?v=something', video_file => 1;
39 WWW::Offliberty is a simple interface to the offliberty.com download service.
41 The module exports (on request) a single function, B<off>(I<url>,
42 [I<parameter> => value, ...]). It takes a URL and an optional list of
43 parameters (key/value pairs). It returns a list of download links. An
44 empty list is returned if the Offliberty service returns no URLs (for
45 example if Offliberty encounters an error or the URL is invalid). Dies
46 if unable to contact Offliberty (for example if there is no internet
47 connection or a firewall blocks the connection).
49 The supported services and parameters are undocumented. From empirical
50 testing, when requesting a YouTube URL the service will return an
51 audio-only URL when called with no parameters, and two URLs
52 (audio-only and audio/video) when called with the parameter
53 B<video_file> set to B<1>. In contrast, Vimeo URLs with no parameters
54 return both audio-only and audio/video variants.
58 L<http://offliberty.com>
62 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
64 =head1 COPYRIGHT AND LICENSE
66 Copyright (C) 2013-2015 by Marius Gavrilescu
68 This library is free software; you can redistribute it and/or modify
69 it under the same terms as Perl itself, either Perl version 5.18.1 or,
70 at your option, any later version of Perl 5 you may have available.
This page took 0.061665 seconds and 4 git commands to generate.