fix quoting in AsyncWgetFileGetter again
[videosite.git] / videosite / GrabberBase.pm
index e354bc9..576d7e4 100644 (file)
@@ -3,19 +3,20 @@
 
 package videosite::GrabberBase;
 use videosite::Base;
+use MIME::Base64;
+use Data::Dumper;
 @ISA = qw(videosite::Base);
 
 use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self = {%{$self},
+    my $self = $class->SUPER::new(
         NAME => 'FlashGrab',
         TYPE => 'grabber',
         PATTERNS => [],
-    };
+        @_,
+    );
     return bless($self, $class);
 }
 
@@ -40,6 +41,12 @@ sub get($$) {
                     last;
                 }
             }
+            if (defined($res)) {
+                if (defined($self->_cached_ua())) {
+                    $res->{COOKIES} = encode_base64("#LWP-Cookies-1.0\n" . $self->_cached_ua()->cookie_jar->as_string(), "");
+                }
+            }
+
             return wantarray?($res, $pattern):$res;
         }
     }