Automatically add cookies gathered during grabbing to the metadata
[videosite.git] / videosite / GrabberBase.pm
index e354bc9..b31d934 100644 (file)
@@ -3,6 +3,8 @@
 
 package videosite::GrabberBase;
 use videosite::Base;
+use MIME::Base64;
+use Data::Dumper;
 @ISA = qw(videosite::Base);
 
 use strict;
@@ -40,6 +42,14 @@ sub get($$) {
                     last;
                 }
             }
+            if (defined($res)) {
+                print Dumper($res);
+                print Dumper($self->_cached_ua());
+                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;
         }
     }