X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=videosite%2FVimeoGrabber.pm;h=ba76cff9aff0032c82d0c6372429ff02a003249c;hb=8f82d425fa17990e24c78232e69b20f07e386ef5;hp=951e014b5a976089ef4e30400508543524fddc95;hpb=27aca6bd4e1eb50e4c6c3680145b0a96762161ad;p=videosite.git diff --git a/videosite/VimeoGrabber.pm b/videosite/VimeoGrabber.pm index 951e014..ba76cff 100644 --- a/videosite/VimeoGrabber.pm +++ b/videosite/VimeoGrabber.pm @@ -3,12 +3,12 @@ # # Grabber for vimeo.com -package VimeoGrabber; +package videosite::VimeoGrabber; -use GrabberBase; -@ISA = qw(GrabberBase); +use videosite::GrabberBase; +@ISA = qw(videosite::GrabberBase); -use LWP::Simple qw(!get); +use LWP::UserAgent; use XML::Simple; use Digest::MD5 qw(md5_hex); use Data::Dumper; @@ -41,6 +41,7 @@ sub _parse { my $dlpath; my $timestamp; my $hash; + my $ua = LWP::UserAgent->new(agent => 'Mozilla'); $url =~ m|$pattern|; $url = $1; @@ -53,11 +54,14 @@ sub _parse { $metadata->{'DLURL'} = undef; # Get the XML file containing the video metadata - unless(defined($content = LWP::Simple::get(sprintf('http://www.vimeo.com/moogaloop/load/clip:%s/local?context=default&context_id=undefined', $2)))) { + $content = $ua->get(sprintf('http://www.vimeo.com/moogaloop/load/clip:%s', $2)); + unless ($content->is_success()) { $self->error('Could not download XML metadata'); return undef; } + $content = $content->decoded_content(); + unless(defined($t = $p->XMLin($content, KeepRoot => 1))) { $self->error('Could not parse XML metadata'); return undef; @@ -70,8 +74,9 @@ sub _parse { $self->debug('Selecting SD video'); $hd = ''; } - $timestamp = $t->{'xml'}->{'timestamp'}; - $dlurl = sprintf('http://vimeo.com/moogaloop/play/clip:%s/1/%d%s', $metadata->{'ID'}, $timestamp, $hd); + $timestamp = $t->{'xml'}->{'request_signature_expires'}; + $hash = $t->{'xml'}->{'request_signature'}; + $dlurl = sprintf('http://vimeo.com/moogaloop/play/clip:%s/%s/%d%s', $metadata->{'ID'}, $hash, $timestamp, $hd); unless(defined($dlurl)) { $self->error('No dlurl found in XML');