aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZakariyya Mughal <zaki.mughal@gmail.com>2012-12-04 15:05:21 -0600
committerZakariyya Mughal <zaki.mughal@gmail.com>2012-12-04 15:05:21 -0600
commit52fae7a0277867569efa02758c2322a626fd2ba1 (patch)
treea9683bb86445ec10124835b468735034f4ca9e68
parentc35629a28081eef32e5f123418795d73384bc99a (diff)
downloadget-flash-videos-52fae7a0277867569efa02758c2322a626fd2ba1.tar.gz
change HTTP response check method
-rw-r--r--lib/FlashVideo/Site/Putlocker.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/FlashVideo/Site/Putlocker.pm b/lib/FlashVideo/Site/Putlocker.pm
index 5bb33b4..c8016d6 100644
--- a/lib/FlashVideo/Site/Putlocker.pm
+++ b/lib/FlashVideo/Site/Putlocker.pm
@@ -9,6 +9,8 @@ use HTML::Entities qw(decode_entities);
sub find_video {
my ($self, $browser, $embed_url) = @_;
+ die 'Could not retrieve video' unless ($browser->success);
+
my ($filename) = title_to_filename(extract_title($browser));
$filename =~ s/[\s\|_]*PutLocker[\s_]*//;
@@ -31,7 +33,7 @@ sub find_video {
]);
# request is successful - die if not
- die 'Response code was ' . $response->code . '. Should be 200.' unless ($response->code == '200');
+ die 'Request not successful' unless ($browser->success);
my $page_html = $response->content;
@@ -46,6 +48,7 @@ sub find_video {
#parse the url and title out of the response - much easier to regex it out, as the XML has dodgy &'s.
$browser->allow_redirects;
my $contents = $browser->get($uri)->content;
+ die 'Unable to download video information' unless ($browser->success);
my ($url) = ($contents =~ /url="(.*?)"/);
$url = decode_entities($url);