From 27aca6bd4e1eb50e4c6c3680145b0a96762161ad Mon Sep 17 00:00:00 2001 From: Ralf Ertzinger Date: Sun, 12 Oct 2008 13:29:39 +0200 Subject: [PATCH] - Make vimeo work again (they have reworked their hash scheme, but forgotten to actually check it on the server, it seems) --- videosite/VimeoGrabber.pm | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/videosite/VimeoGrabber.pm b/videosite/VimeoGrabber.pm index b293ed8..951e014 100644 --- a/videosite/VimeoGrabber.pm +++ b/videosite/VimeoGrabber.pm @@ -37,6 +37,7 @@ sub _parse { my $p = XML::Simple->new(); my $t; my $dlurl; + my $hd; my $dlpath; my $timestamp; my $hash; @@ -62,32 +63,34 @@ sub _parse { return undef; } - if (exists($t->{'xml'}->{'video'}->{'is_hd'}) and (0 != $t->{'xml'}->{'video'}->{'is_hd'})) { + if (exists($t->{'xml'}->{'video'}->{'isHD'}) and (0 != $t->{'xml'}->{'video'}->{'isHD'})) { $self->debug('Selecting HD video'); - $dlurl = $t->{'xml'}->{'video'}->{'hd_file'}; + $hd = '/?q=hd'; } else { $self->debug('Selecting SD video'); - $dlurl = $t->{'xml'}->{'video'}->{'file'}; + $hd = ''; } $timestamp = $t->{'xml'}->{'timestamp'}; + $dlurl = sprintf('http://vimeo.com/moogaloop/play/clip:%s/1/%d%s', $metadata->{'ID'}, $timestamp, $hd); unless(defined($dlurl)) { $self->error('No dlurl found in XML'); return undef; } - # Vimeo appends a hash to the download URL, in order to thwart people like me. - # Unfortunately the algorithm isn't that complicated :) - if ($dlurl =~ m|http://bitcast.vimeo.com(.+)|) { - $dlpath = $1; - $timestamp += 1800; - $hash = md5_hex(sprintf('redFiretruck%s?e=%d', $dlpath, $timestamp)); - } else { - $self->error('Unknown dlurl scheme: %s', $dlurl); - return undef; - } - - $metadata->{'DLURL'} = sprintf('%s?e=%d&h=%s', $dlurl, $timestamp, $hash); + # # Vimeo appends a hash to the download URL, in order to thwart people like me. + # # Unfortunately the algorithm isn't that complicated :) + # if ($dlurl =~ m|http://bitcast.vimeo.com(.+)|) { + # $dlpath = $1; + # $timestamp += 1800; + # $hash = md5_hex(sprintf('redFiretruck%s?e=%d', $dlpath, $timestamp)); + # } else { + # $self->error('Unknown dlurl scheme: %s', $dlurl); + # return undef; + # } + + # $metadata->{'DLURL'} = sprintf('%s?e=%d&h=%s', $dlurl, $timestamp, $hash); + $metadata->{'DLURL'} = $dlurl; $metadata->{'TITLE'} = $t->{'xml'}->{'video'}->{'caption'}; unless(defined($metadata->{'DLURL'}) && defined($metadata->{'TITLE'})) { -- 1.8.3.1