diff options
author | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-09 12:07:56 +0000 |
---|---|---|
committer | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-09 12:07:56 +0000 |
commit | 6852eba3ed79976ba23d76b02601dedcb0b80baf (patch) | |
tree | 96ce70ee7a3670d00fe62f75f2f3b7523f95e557 | |
parent | 825418c01af4249ca56ec20d1be7d82fdeb1272e (diff) | |
download | get-flash-videos-6852eba3ed79976ba23d76b02601dedcb0b80baf.tar.gz |
Add redirection to the plugin
-rw-r--r-- | lib/FlashVideo/Site/Vimeo.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/FlashVideo/Site/Vimeo.pm b/lib/FlashVideo/Site/Vimeo.pm index cfff570..7a6e13a 100644 --- a/lib/FlashVideo/Site/Vimeo.pm +++ b/lib/FlashVideo/Site/Vimeo.pm @@ -6,10 +6,22 @@ use warnings; use FlashVideo::Utils; use FlashVideo::JSON; +our $VERSION = '0.01'; +sub Version() { $VERSION; } + sub find_video { my ($self, $browser, $embed_url) = @_; my $id; + + if ($browser->response->is_redirect) { + my $relurl = $browser->response->header('Location'); + info "Relocated to $relurl"; + $browser->get($relurl); + } + + my $page_url = $browser->uri->as_string; + if ($embed_url =~ /clip_id=(\d+)/) { $id = $1; } elsif ($embed_url =~ m!/(\d+)!) { |