diff options
author | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-25 18:38:16 +0000 |
---|---|---|
committer | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-27 00:32:12 +0000 |
commit | 8ec63ea696450b0f6b7b618e84429b6b4d7e0916 (patch) | |
tree | dd5cdcdd96855add54ec9643b79f631d1ef30759 | |
parent | c5bfbaaff0db33c7b453c368daf6f1e07b68703b (diff) | |
download | get-flash-videos-8ec63ea696450b0f6b7b618e84429b6b4d7e0916.tar.gz |
Correct the updates sent in, add version for plugin.
-rw-r--r-- | lib/FlashVideo/Site/Wat.pm | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/FlashVideo/Site/Wat.pm b/lib/FlashVideo/Site/Wat.pm index 41a99e9..f799fef 100644 --- a/lib/FlashVideo/Site/Wat.pm +++ b/lib/FlashVideo/Site/Wat.pm @@ -6,18 +6,24 @@ use FlashVideo::Utils; use HTML::Entities; use URI::Escape; +our $VERSION = '0.01'; +sub Version { $VERSION; } + die "Must have Digest::MD5 for this download\n" unless eval { require Digest::MD5; }; sub token { - my $url = shift; - my $hexdate = $browser->get("http://www.wat.tv/servertime"); - my @timestamp=split('|',$hexdate); - $hexdate=sprintf("%x",shift(@timestamp)); + my ($url, $browser) = @_; + + $browser->get("http://www.wat.tv/servertime"); + + my $hexdate = $browser->content; + my @timestamp = split('\|', $hexdate); + $hexdate = sprintf("%x", shift(@timestamp)); my $key = "9b673b13fa4682ed14c3cfa5af5310274b514c4133e9b3a81e6e3aba00912564"; - return Digest::MD5::md5_hex($key . $url . $hexdate)."/".$hexdate; + return Digest::MD5::md5_hex($key . $url . $hexdate) . "/" . $hexdate; } @@ -33,7 +39,7 @@ sub find_video { my $title = json_unescape(($browser->content =~ /title":"(.*?)",/)[0]); my $location = "/web/$video_id"; - my $token = &token($location); + my $token = &token($location, $browser); my $url = "http://www.wat.tv/get".$location. "?token=".$token. |