- # # 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($r)) {
+ $self->error("Found information hash, but could not parse");
+ return undef;
+ }
+
+ $self->debug("Found parsed config: %s", Dumper($r));
+
+ unless(exists($r->{'config'}->{'request'})) {
+ $self->error("Required information not found in hash");
+ return undef;
+ }
+
+ $metadata->{'TITLE'} = $r->{'config'}->{'video'}->{'title'};
+ $r = $r->{'config'}->{'request'};
+
+ $metadata->{'DLURL'} = sprintf("http://%s/play_redirect?clip_id=%d&sig=%s&time=%d&quality=hd&codecs=H264,VP8,VP6",
+ $r->{'player_url'},
+ $metadata->{'ID'},
+ $r->{'signature'},
+ $r->{'timestamp'},
+ );
+ }
+ }
+ }