Merge branch 'devel'
[videosite.git] / videosite / MotherlessGrabber.pm
index bbbe1a8..9f3feaa 100644 (file)
@@ -17,17 +17,15 @@ use strict;
 
 sub new {
     my $class = shift;
-    my $self = $class->SUPER::new();
-
-    $self->{'NAME'} = 'motherless';
-    $self->{_SELFTESTURL} = 'http://motherless.com/4976432';
-    $self->{_SELFTESTTITLE} = 'Teen masturbation in shower';
-    $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*motherless.com/([a-zA-Z0-9]+))'];
-
-    bless($self, $class);
-    $self->_prepare_parameters();
-
-    return $self;
+    my $self = $class->SUPER::new(
+        NAME => 'motherless',
+        _SELFTESTURL => 'http://motherless.com/4976432',
+        _SELFTESTTITLE => 'Teen Masturbating In Shower',
+        PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*motherless.com/([a-zA-Z0-9]+))'],
+        @_,
+    );
+
+    return bless($self, $class);
 }
 
 sub _parse {
@@ -61,11 +59,9 @@ sub _parse {
     $p = HTML::TokeParser->new(\$content);
 
     # Look for the title
-    while ($tag = $p->get_tag('title', 'script')) {
-        if ('title' eq $tag->[0]) {
-            my $t = $p->get_text();
-            $metadata->{'TITLE'} = $t;
-            $metadata->{'TITLE'} =~ s/.* : *//;
+    while ($tag = $p->get_tag('meta', 'script')) {
+        if (('meta' eq $tag->[0]) and ($tag->[1]->{'name'}) and ($tag->[1]->{'name'} eq 'description')) {
+            $metadata->{'TITLE'} = $tag->[1]->{'content'};
         } elsif ('script' eq $tag->[0]) {
             my $t = $p->get_text();