diff options
author | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-27 00:10:24 +0000 |
---|---|---|
committer | Nigel Taylor <njtaylor0101@gmail.com> | 2013-03-27 00:10:24 +0000 |
commit | 76d5737290c95a236ed87171d014000a66a43ab5 (patch) | |
tree | 19be0a4b03dbb98863daaddbf7d51aa7a3acdd9e | |
parent | 640bcf866a495e67375d1db8caaf0203a54ff033 (diff) | |
parent | f6c25880d8297787767c6ecab433867e1875c345 (diff) | |
download | get-flash-videos-76d5737290c95a236ed87171d014000a66a43ab5.tar.gz |
Update Wat.pm with fixes.
-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 b9cfe5b..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 = sprintf("%x",time()); - # fill up triling zeroes - $hexdate .= "0" x (length($hexdate) - 8); + 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. |