diff options
author | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-25 18:38:16 +0000 |
---|---|---|
committer | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-25 18:38:16 +0000 |
commit | f6c25880d8297787767c6ecab433867e1875c345 (patch) | |
tree | 5ed73fe59387965d21b052bb37815497e201fb3c | |
parent | 835511742c51712e1fc7db818eb43ca8bb8bb317 (diff) | |
download | get-flash-videos-f6c25880d8297787767c6ecab433867e1875c345.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. |