From: Ralf Ertzinger Date: Sun, 21 Apr 2013 17:32:48 +0000 (+0200) Subject: Change new() function in plugins to avoid having to call _prepare_parameters() in... X-Git-Url: https://git.camperquake.de/gitweb.cgi?p=videosite.git;a=commitdiff_plain;h=17bca93d2b471f5f099a4046297159a029989430 Change new() function in plugins to avoid having to call _prepare_parameters() in each --- diff --git a/videosite/AsyncFileGetter.pm b/videosite/AsyncFileGetter.pm index 984597d..4250bf4 100644 --- a/videosite/AsyncFileGetter.pm +++ b/videosite/AsyncFileGetter.pm @@ -20,14 +20,11 @@ use MIME::Base64; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'asyncfilegetter', + ); - $self->{'NAME'} = 'asyncfilegetter'; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub get { diff --git a/videosite/AsyncWgetFileGetter.pm b/videosite/AsyncWgetFileGetter.pm index d52a2ef..fd8c5f9 100644 --- a/videosite/AsyncWgetFileGetter.pm +++ b/videosite/AsyncWgetFileGetter.pm @@ -20,14 +20,11 @@ use MIME::Base64; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'asyncwgetfilegetter', + ); - $self->{'NAME'} = 'asyncwgetfilegetter'; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub get { diff --git a/videosite/Base.pm b/videosite/Base.pm index f6108f6..606d6f4 100644 --- a/videosite/Base.pm +++ b/videosite/Base.pm @@ -15,6 +15,7 @@ sub new { '_CONNECTORS' => sub { return ({ 'name' => 'direct', 'schemas' => {} }) }, '_CONNECTOR' => undef, + @_, }; bless($self, $class); diff --git a/videosite/BlipTVGrabber.pm b/videosite/BlipTVGrabber.pm index 2a48541..20dc0d5 100644 --- a/videosite/BlipTVGrabber.pm +++ b/videosite/BlipTVGrabber.pm @@ -16,17 +16,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'bliptv'; - $self->{_SELFTESTURL} = 'http://blip.tv/rebelliouspixelscom/buffy-vs-edward-twilight-remixed-2274024'; - $self->{_SELFTESTTITLE} = 'Buffy vs Edward (Twilight Remixed)'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*blip.tv/\S+/\S+)']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'bliptv', + _SELFTESTURL => 'http://blip.tv/rebelliouspixelscom/buffy-vs-edward-twilight-remixed-2274024', + _SELFTESTTITLE => 'Buffy vs Edward (Twilight Remixed)', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*blip.tv/\S+/\S+)'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/BreakGrabber.pm b/videosite/BreakGrabber.pm index 0896078..6e4d02f 100644 --- a/videosite/BreakGrabber.pm +++ b/videosite/BreakGrabber.pm @@ -15,16 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'break', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*break.com/index/([-a-zA-Z0-9_]+?)\.html)'], + ); - $self->{'NAME'} = 'break'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*break.com/index/([-a-zA-Z0-9_]+?)\.html)']; - - bless($self, $class); - - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/BroadcasterGrabber.pm b/videosite/BroadcasterGrabber.pm index 5891acb..8e18e12 100644 --- a/videosite/BroadcasterGrabber.pm +++ b/videosite/BroadcasterGrabber.pm @@ -15,15 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'broadcaster', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*broadcaster\.com/clip/(\d+))'], + ); - $self->{'NAME'} = 'broadcaster'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*broadcaster\.com/clip/(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/CollegeHumorGrabber.pm b/videosite/CollegeHumorGrabber.pm index 7fb3cae..1e20d69 100644 --- a/videosite/CollegeHumorGrabber.pm +++ b/videosite/CollegeHumorGrabber.pm @@ -16,18 +16,15 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'collegehumor'; - $self->{_SELFTESTURL} = 'http://www.collegehumor.com/video/5635400/pixar-intro-parody'; - $self->{_SELFTESTTITLE} = 'Pixar Intro Parody'; - $self->{'PATTERNS'} = ['(http://www.collegehumor.com/video:(\d+))', - '(http://www.collegehumor.com/video/(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'collegehumor', + _SELFTESTURL => 'http://www.collegehumor.com/video/5635400/pixar-intro-parody', + _SELFTESTTITLE => 'Pixar Intro Parody', + PATTERNS => ['(http://www.collegehumor.com/video:(\d+))', + '(http://www.collegehumor.com/video/(\d+))'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/DailyMotionGrabber.pm b/videosite/DailyMotionGrabber.pm index 6544882..aa7d279 100644 --- a/videosite/DailyMotionGrabber.pm +++ b/videosite/DailyMotionGrabber.pm @@ -16,16 +16,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'dailymotion', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*dailymotion.com/(?:[^/]+/)*video/([-a-zA-Z0-9_]+))'], + ); - $self->{'NAME'} = 'dailymotion'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*dailymotion.com/(?:[^/]+/)*video/([-a-zA-Z0-9_]+))']; - - bless($self, $class); - - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/DoubleVikingGrabber.pm b/videosite/DoubleVikingGrabber.pm index e79c261..81ba370 100644 --- a/videosite/DoubleVikingGrabber.pm +++ b/videosite/DoubleVikingGrabber.pm @@ -15,15 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'doubleviking', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*doubleviking.com/videos/(?:[-a-zA-Z0-9_ %]+/)*page0\.html/(\d+)\.html$)'], + ); - $self->{'NAME'} = 'doubleviking'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*doubleviking.com/videos/(?:[-a-zA-Z0-9_ %]+/)*page0\.html/(\d+)\.html$)']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/FileGetter.pm b/videosite/FileGetter.pm index f7c680e..0d2b250 100644 --- a/videosite/FileGetter.pm +++ b/videosite/FileGetter.pm @@ -14,15 +14,15 @@ use File::Basename; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'filegetter'; - $self->{'_PARAMS'} = {'MINFREE' => ['500000', 'The amount of space that needs to be available on the filesystem before the video is downloaded (in kilobytes)'], 'FILEPATTERN', => ['/tmp/%s - %s - %s.flv', "The file name to save the file under. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are encoded (space and / replaced by _)"]}; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'filegetter', + _PARAMS => { + MINFREE => ['500000', 'The amount of space that needs to be available on the filesystem before the video is downloaded (in kilobytes)'], + FILEPATTERN => ['/tmp/%s - %s - %s.flv', "The file name to save the file under. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are encoded (space and / replaced by _)"] + }, + ); + + return bless($self, $class); } sub get { diff --git a/videosite/GetterBase.pm b/videosite/GetterBase.pm index c7d56de..52e8a4d 100644 --- a/videosite/GetterBase.pm +++ b/videosite/GetterBase.pm @@ -10,12 +10,11 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self = {%{$self}, + my $self = $class->SUPER::new( NAME => 'FlashGetter', - TYPE => 'getter' - }; + TYPE => 'getter', + @_, + ); return bless($self, $class); } diff --git a/videosite/GoogleGrabber.pm b/videosite/GoogleGrabber.pm index 4915603..665fc44 100644 --- a/videosite/GoogleGrabber.pm +++ b/videosite/GoogleGrabber.pm @@ -15,16 +15,15 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'google'; - $self->{'PATTERNS'} = ['(http://video\.google\.com/videoplay\?docid=([-\d]+))']; - $self->{'_PARAMS'} = {'QUALITY' => ['normal', 'Quality of the video to download. normal = standard resolution flash video, h264 = high resolution MPEG4 video']}; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'google', + PATTERNS => ['(http://video\.google\.com/videoplay\?docid=([-\d]+))'], + _PARAMS => { + QUALITY => ['normal', 'Quality of the video to download. normal = standard resolution flash video, h264 = high resolution MPEG4 video'] + }, + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/GrabberBase.pm b/videosite/GrabberBase.pm index 44bde35..576d7e4 100644 --- a/videosite/GrabberBase.pm +++ b/videosite/GrabberBase.pm @@ -11,13 +11,12 @@ 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); } diff --git a/videosite/HTTPJSONGetter.pm b/videosite/HTTPJSONGetter.pm index 87a6d83..0c409a9 100644 --- a/videosite/HTTPJSONGetter.pm +++ b/videosite/HTTPJSONGetter.pm @@ -14,15 +14,14 @@ use JSON -support_by_pp; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'HTTPJSONGetter'; - $self->{'_PARAMS'} = {'URL' => ['http://www.example.com/getjson.pl', "The URL to call in order to trigger a download. The JSON encoded information will be POSTed to this URL."]}; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'HTTPJSONGetter', + _PARAMS => { + URL => ['http://www.example.com/getjson.pl', "The URL to call in order to trigger a download. The JSON encoded information will be POSTed to this URL."] + }, + ); + + return bless($self, $class); } sub get { diff --git a/videosite/HTTPRPCGetter.pm b/videosite/HTTPRPCGetter.pm index 16ef726..fb0fd95 100644 --- a/videosite/HTTPRPCGetter.pm +++ b/videosite/HTTPRPCGetter.pm @@ -14,15 +14,14 @@ use LWP::Simple qw(!get); sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'HTTPRPCGetter'; - $self->{'_PARAMS'} = {'URL' => ['http://www.example.com/get.pl?type=%s&vid=%s&title=%s&url=%s', "The URL to call in order to trigger a download. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are hexencoded"]}; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'HTTPRPCGetter', + _PARAMS => { + URL => ['http://www.example.com/get.pl?type=%s&vid=%s&title=%s&url=%s', "The URL to call in order to trigger a download. This is a string which is passed to a sprintf call later on. The parameters passed to that sprintf call, in order, are:\n- The site the video is from\n- The ID of the video\n- The title of the video\n- The URL of the video file itself\n- The URL of the site the video was taken from\nAll parameters are hexencoded"] + }, + ); + + return bless($self, $class); } sub get { diff --git a/videosite/LiveLeakGrabber.pm b/videosite/LiveLeakGrabber.pm index 27f4c7f..b0d6fee 100644 --- a/videosite/LiveLeakGrabber.pm +++ b/videosite/LiveLeakGrabber.pm @@ -15,15 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'liveleak', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*liveleak.com/view\?i=([^\&]+))'], + ); - $self->{'NAME'} = 'liveleak'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*liveleak.com/view\?i=([^\&]+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/MNCastGrabber.pm b/videosite/MNCastGrabber.pm index 19c1969..7b12e03 100644 --- a/videosite/MNCastGrabber.pm +++ b/videosite/MNCastGrabber.pm @@ -16,15 +16,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'mncast', + PATTERNS => ['(http://www\.mncast\.com/\?(\d+))'], + ); - $self->{'NAME'} = 'mncast'; - $self->{'PATTERNS'} = ['(http://www\.mncast\.com/\?(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/MetaCafeGrabber.pm b/videosite/MetaCafeGrabber.pm index e134bec..e7f51d5 100644 --- a/videosite/MetaCafeGrabber.pm +++ b/videosite/MetaCafeGrabber.pm @@ -15,16 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'metacafe', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*metacafe.com/watch/(\d+)(?:\S+)?)'], + ); - $self->{'NAME'} = 'metacafe'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*metacafe.com/watch/(\d+)(?:\S+)?)']; - - bless($self, $class); - - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/MotherlessGrabber.pm b/videosite/MotherlessGrabber.pm index bbbe1a8..0b24870 100644 --- a/videosite/MotherlessGrabber.pm +++ b/videosite/MotherlessGrabber.pm @@ -17,17 +17,14 @@ 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 masturbation in shower', + _PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*motherless.com/([a-zA-Z0-9]+))'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/MyVideoGrabber.pm b/videosite/MyVideoGrabber.pm index 3028466..e908ebd 100644 --- a/videosite/MyVideoGrabber.pm +++ b/videosite/MyVideoGrabber.pm @@ -15,15 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'myvideo', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*myvideo.de/watch/(\d+))'], + ); - $self->{'NAME'} = 'myvideo'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*myvideo.de/watch/(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/NullGetter.pm b/videosite/NullGetter.pm index 28e62f5..27aa76e 100644 --- a/videosite/NullGetter.pm +++ b/videosite/NullGetter.pm @@ -14,14 +14,11 @@ use LWP::Simple qw(!get); sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'nullgetter', + ); - $self->{'NAME'} = 'nullgetter'; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub get { diff --git a/videosite/RedTubeGrabber.pm b/videosite/RedTubeGrabber.pm index df01837..0966ca9 100644 --- a/videosite/RedTubeGrabber.pm +++ b/videosite/RedTubeGrabber.pm @@ -18,17 +18,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'redtube'; - $self->{_SELFTESTURL} = 'http://www.redtube.com/8269'; - $self->{_SELFTESTTITLE} = 'Porn bloopers with pretty girl'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*redtube.com/(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'redtube', + _SELFTESTURL => 'http://www.redtube.com/8269', + _SELFTESTTITLE => 'Porn bloopers with pretty girl', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*redtube.com/(\d+))'], + ); + + return bless($self, $class); } sub div($$) { diff --git a/videosite/SevenloadGrabber.pm b/videosite/SevenloadGrabber.pm index 4d3482f..897b24b 100644 --- a/videosite/SevenloadGrabber.pm +++ b/videosite/SevenloadGrabber.pm @@ -15,17 +15,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'sevenload'; - $self->{_SELFTESTURL} = 'http://de.sevenload.com/videos/uqDvKzh-vilogo-TV-Spot'; - $self->{_SELFTESTTITLE} = 'vilogo TV-Spot'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*sevenload.com/videos/(\w+?)-.*)']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'sevenload', + _SELFTESTURL => 'http://de.sevenload.com/videos/uqDvKzh-vilogo-TV-Spot', + _SELFTESTTITLE => 'vilogo TV-Spot', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*sevenload.com/videos/(\w+?)-.*)'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/SnotrGrabber.pm b/videosite/SnotrGrabber.pm index 3009995..9f4e857 100644 --- a/videosite/SnotrGrabber.pm +++ b/videosite/SnotrGrabber.pm @@ -15,17 +15,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'snotr'; - $self->{_SELFTESTURL} = 'http://www.snotr.com/video/1836'; - $self->{_SELFTESTTITLE} = 'Brilliant thief'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*snotr\.com/video/(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'snotr', + _SELFTESTURL => 'http://www.snotr.com/video/1836', + _SELFTESTTITLE => 'Brilliant thief', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*snotr\.com/video/(\d+))'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/SpikedHumorGrabber.pm b/videosite/SpikedHumorGrabber.pm index 5d0f6ae..b903ad8 100644 --- a/videosite/SpikedHumorGrabber.pm +++ b/videosite/SpikedHumorGrabber.pm @@ -15,15 +15,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'spikedhumor', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*spikedhumor.com/articles/(\d+)(?:/.*)*)'], + ); - $self->{'NAME'} = 'spikedhumor'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*spikedhumor.com/articles/(\d+)(?:/.*)*)']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/VeohGrabber.pm b/videosite/VeohGrabber.pm index dda2b5d..1b118d1 100644 --- a/videosite/VeohGrabber.pm +++ b/videosite/VeohGrabber.pm @@ -14,17 +14,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'veoh'; - $self->{_SELFTESTURL} = 'http://www.veoh.com/watch/v18348952fyn2twbe'; - $self->{_SELFTESTTITLE} = '518_2 kureyon shinchan'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*veoh.com/+watch/(\w+)\??)']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'veoh', + _SELFTESTURL => 'http://www.veoh.com/watch/v18348952fyn2twbe', + _SELFTESTTITLE => '518_2 kureyon shinchan', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*veoh.com/+watch/(\w+)\??)'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/VimeoGrabber.pm b/videosite/VimeoGrabber.pm index 9b2b689..e39c494 100644 --- a/videosite/VimeoGrabber.pm +++ b/videosite/VimeoGrabber.pm @@ -16,17 +16,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'vimeo'; - $self->{_SELFTESTURL} = 'http://vimeo.com/35055590'; - $self->{_SELFTESTTITLE} = 'Hello'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*vimeo.com/(?:m/)?(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'vimeo', + _SELFTESTURL => 'http://vimeo.com/35055590', + _SELFTESTTITLE => 'Hello', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*vimeo.com/(?:m/)?(\d+))'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/WimpGrabber.pm b/videosite/WimpGrabber.pm index e9b14ff..a09a39e 100644 --- a/videosite/WimpGrabber.pm +++ b/videosite/WimpGrabber.pm @@ -16,18 +16,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'wimp'; - $self->{_SELFTESTURL} = 'http://www.wimp.com/insanebuilding/'; - $self->{_SELFTESTTITLE} = 'Insane building.'; - $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*wimp.com/([^/]+)/?)']; - - bless($self, $class); - - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'wimp', + _SELFTESTURL => 'http://www.wimp.com/insanebuilding/', + _SELFTESTTITLE => 'Insane building.', + PATTERNS => ['(http://(?:[-a-zA-Z0-9_.]+\.)*wimp.com/([^/]+)/?)'], + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/YahooGrabber.pm b/videosite/YahooGrabber.pm index fc88043..44715f9 100644 --- a/videosite/YahooGrabber.pm +++ b/videosite/YahooGrabber.pm @@ -16,15 +16,12 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); + my $self = $class->SUPER::new( + NAME => 'yahoo', + PATTERNS => ['(http://video\.yahoo\.com/watch/\d+/(\d+))'], + ); - $self->{'NAME'} = 'yahoo'; - $self->{'PATTERNS'} = ['(http://video\.yahoo\.com/watch/\d+/(\d+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + return bless($self, $class); } sub _parse { diff --git a/videosite/YouTubeGrabber.pm b/videosite/YouTubeGrabber.pm index 10b1c2e..59d748b 100644 --- a/videosite/YouTubeGrabber.pm +++ b/videosite/YouTubeGrabber.pm @@ -53,34 +53,32 @@ my %videoformats = ( sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'youtube'; - $self->{_SELFTESTURL} = 'http://www.youtube.com/watch?v=dMH0bHeiRNg'; - $self->{_SELFTESTTITLE} = 'Evolution of Dance - By Judson Laipply'; - $self->{'PATTERNS'} = ['(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch(?:_popup)?\?.*?v=([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch\#\!v=([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/v/([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/embed/([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/[[:alnum:]]+\?v=([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/(?:user/)?[[:alnum:]]+#p/(?:\w+/)+\d+/([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/watch\?v=([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/([-a-zA-Z0-9_]+))', - '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/\w+\?.*/([-a-zA-Z0-9_]+))']; - $self->{'_PARAMS'} = { - 'QUALITY' => ['normal', 'Quality of the video to download.', { - 'normal' => 'standard resolution flash video', - 'high' => 'higher resolution flash video', - 'h264' => 'high resolution MPEG4 video', - 'hd' => 'HD720 resolution'}], - 'USERNAME' => ['', 'Username to use for YouTube login'], - 'PASSWORD' => ['', 'Password to use for YouTube login'], - 'HTTPS' => [1, 'Whether to use HTTPS (if available) to connect to YouTube']}; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'youtube', + _SELFTESTURL => 'http://www.youtube.com/watch?v=dMH0bHeiRNg', + _SELFTESTTITLE => 'Evolution of Dance - By Judson Laipply', + PATTERNS => ['(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch(?:_popup)?\?.*?v=([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/watch\#\!v=([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/v/([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/embed/([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/[[:alnum:]]+\?v=([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/(?:user/)?[[:alnum:]]+#p/(?:\w+/)+\d+/([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/watch\?v=([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtu\.be/([-a-zA-Z0-9_]+))', + '(https?://(?:[-a-zA-Z0-9_.]+\.)*youtube\.(?:com|de|co.uk)/user/\w+\?.*/([-a-zA-Z0-9_]+))'], + _PARAMS => { + QUALITY => ['normal', 'Quality of the video to download.', { + normal => 'standard resolution flash video', + high => 'higher resolution flash video', + h264 => 'high resolution MPEG4 video', + hd => 'HD720 resolution'}], + USERNAME => ['', 'Username to use for YouTube login'], + PASSWORD => ['', 'Password to use for YouTube login'], + HTTPS => [1, 'Whether to use HTTPS (if available) to connect to YouTube'] + }, + ); + + return bless($self, $class); } sub _parse { diff --git a/videosite/ZeroPunctuationGrabber.pm b/videosite/ZeroPunctuationGrabber.pm index a9538fe..241f4b6 100644 --- a/videosite/ZeroPunctuationGrabber.pm +++ b/videosite/ZeroPunctuationGrabber.pm @@ -16,17 +16,14 @@ use strict; sub new { my $class = shift; - my $self = $class->SUPER::new(); - - $self->{'NAME'} = 'zeropunctuation'; - $self->{_SELFTESTURL} = 'http://www.escapistmagazine.com/videos/view/zero-punctuation/5346-Amy'; - $self->{_SELFTESTTITLE} = 'Amy'; - $self->{'PATTERNS'} = ['(http://www.escapistmagazine.com/videos/view/zero-punctuation/([-A-Za-z0-9]+))']; - - bless($self, $class); - $self->_prepare_parameters(); - - return $self; + my $self = $class->SUPER::new( + NAME => 'zeropunctuation', + _SELFTESTURL => 'http://www.escapistmagazine.com/videos/view/zero-punctuation/5346-Amy', + _SELFTESTTITLE =>'Amy', + PATTERNS => ['(http://www.escapistmagazine.com/videos/view/zero-punctuation/([-A-Za-z0-9]+))'], + ); + + return bless($self, $class); } sub _parse {