root/lang/perl/plagger/assets/plugins/Filter-FindEnclosures/veoh.pl

Revision 2063, 0.7 kB (checked in by yusukebe, 6 months ago)

Find enclosures from Veoh

Line 
1 # author: yusukebe
2
3 sub handle {
4     my ($self, $url) = @_;
5     $url =~ qr!http://www.veoh.com/videos/.*!;
6 }
7
8 sub find {
9     my ($self, $args) = @_;
10     my $id = $args->{url} =~ qr!videos/(.*)! ? $1 : "";
11     $id = $1 if $id  =~ /(.*)\?/;
12     return unless $id;
13     my $ua = Plagger::UserAgent->new;
14     my $url = "http://www.veoh.com/rest/video/$id/details";
15     my $res = $ua->fetch($url);
16     return if $res->is_error;
17     my $content = $res->content;
18     $content =~ /fullPreviewHashPath="(.*?)"/;
19     my $enclosure = Plagger::Enclosure->new;
20     $enclosure->url($1);
21     $enclosure->type('video/flv');
22     $enclosure->filename("$id.flv");
23     return $enclosure;
24 }
Note: See TracBrowser for help on using the browser.
Hosted by INFOMARKS Corporation
infomarks