Skip to content

Instantly share code, notes, and snippets.

@yusukebe
Created May 22, 2009 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusukebe/115989 to your computer and use it in GitHub Desktop.
Save yusukebe/115989 to your computer and use it in GitHub Desktop.
# author: yusukebe
sub handle {
my ($self, $url) = @_;
$url =~ qr!www.veoh.com/.*?watch.*?v[0-9a-zA-Z]{14,16}$!;
}
sub find {
my ($self, $args) = @_;
$args->{url} =~ /(v[0-9a-zA-Z]{14,16})$/;
Plagger->context->log( warn => $1 );
my $video_id = $1;
my $api_key = '';
my $ua = Plagger::UserAgent->new;
my $api_url =
"http://www.veoh.com/rest/v2/execute.xml?method=veoh.video.findByPermalink&apiKey=$api_key&permalink=$video_id";
my $res = $ua->get( $api_url );
return unless $res->is_success;
$res->content =~ /ipodUrl="([^\"]+)"/;
if( $1 ) {
my $enclosure = Plagger::Enclosure->new;
$enclosure->url( $1 );
$enclosure->type('video/mp4');
$enclosure->filename("$video_id.mp4");
return $enclosure;
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment