X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=videosite%2FMNCastGrabber.pm;h=45954f980b1cf69e095ad9af854216fa68efda89;hb=2793bf0eb588c2ad4c76a4e2e38793612b69757f;hp=344bc2c40a7aa527cd0efc509ec26608ca13b975;hpb=80046de1470f1960fda3fe24788d6bd29aee2013;p=videosite.git diff --git a/videosite/MNCastGrabber.pm b/videosite/MNCastGrabber.pm index 344bc2c..45954f9 100644 --- a/videosite/MNCastGrabber.pm +++ b/videosite/MNCastGrabber.pm @@ -3,12 +3,11 @@ # # Grabber for mncast.com -package MNCastGrabber; +package videosite::MNCastGrabber; -use GrabberBase; -@ISA = qw(GrabberBase); +use videosite::GrabberBase; +@ISA = qw(videosite::GrabberBase); -use LWP::Simple qw(!get); use XML::Simple; use HTML::TokeParser; use Data::Dumper; @@ -17,15 +16,13 @@ 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 { @@ -38,6 +35,7 @@ sub _parse { my $t; my @accum; my $vid; + my $ua = $self->ua(); $url =~ m|$pattern|; $url = $1; @@ -50,7 +48,7 @@ sub _parse { $metadata->{'DLURL'} = undef; # First, get a webpage containing the video ID - unless(defined($content = LWP::Simple::get(sprintf('http://www.mncast.com/player/index.asp?mnum=%s', $2)))) { + unless(defined($content = $self->simple_get(sprintf('http://www.mncast.com/player/index.asp?mnum=%s', $2), $ua))) { $self->error('Could not download player page'); return undef; } @@ -65,7 +63,7 @@ sub _parse { } # Get the XML file containing the video metadata - unless(defined($content = LWP::Simple::get(sprintf('http://www.mncast.com/_MovieInfo_/_MovieInfoXML_Tag_.asp?movieID=%s&loginPNum=-1&player=0', $vid)))) { + unless(defined($content = $self->simple_get(sprintf('http://www.mncast.com/_MovieInfo_/_MovieInfoXML_Tag_v2.asp?movieID=%s&loginPNum=-1&player=0', $vid), $ua))) { $self->error('Could not download XML metadata'); return undef; }