use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
-use LWP::UserAgent;
use URI;
use URI::QueryParam;
use HTML::Parser;
my @text;
my $e;
my $xml = undef;
- my $ua;
+ my $ua = $self->ua();
$url =~ m|$pattern|;
$url = $1;
if ($pattern eq $self->{'PATTERNS'}->[0]) {
# blip.tv/file pattern
- unless(defined($content = LWP::Simple::get(sprintf('http://blip.tv/file/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://blip.tv/file/%s', $2), $ua))) {
$self->error('Could not download page');
return undef;
}
my $r;
my $u;
- $ua = LWP::UserAgent->new(max_redirect => 0);
+ $ua->max_redirect(0);
$r = $ua->get(sprintf('http://blip.tv/play/%s', $2));
unless(defined($r)) {
}
# Download the XML file containing the stream information
- unless(defined($content = LWP::Simple::get(sprintf('http://blip.tv/rss/flash/%s', $xml)))) {
+ $ua->max_redirect(7);
+ unless(defined($content = $self->simple_get(sprintf('http://blip.tv/rss/flash/%s', $xml), $ua))) {
$self->error('Could not download XML metadata');
return undef;
}
@ISA = qw(videosite::GrabberBase);
use videosite::HTMLHelper;
-use LWP::Simple qw(!get);
use XML::Simple;
use Data::Dumper;
$metadata->{'DLURL'} = undef;
# Get the XML file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://www.collegehumor.com/moogaloop/video/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.collegehumor.com/moogaloop/video/%s', $2)))) {
$self->error('Could not download XML metadata');
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::Parser;
use videosite::JSArrayParser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://www.dailymotion.com/video/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.dailymotion.com/video/%s', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::TokeParser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://www.doubleviking.com/videos/page0.html/%s.html', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.doubleviking.com/videos/page0.html/%s.html', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::TokeParser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://video.google.com/videohosted?docid=%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://video.google.com/videohosted?docid=%s', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::TokeParser;
use Data::Dumper;
my $content;
my $metadata = {};
my $p;
+ my $ua = $self->ua();
$url =~ m|$pattern|;
$url = $1;
$metadata->{'DLURL'} = undef;
# Get the site to extract the title
- unless(defined($content = LWP::Simple::get($url))) {
+ unless(defined($content = $self->simple_get($url, $ua))) {
$self->error('Could not download page');
return undef;
}
}
# Get the file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://www.liveleak.com/mi?token=%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.liveleak.com/mi?token=%s', $2), $ua))) {
$self->error('Could not download metadata');
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use XML::Simple;
use HTML::TokeParser;
use Data::Dumper;
my $t;
my @accum;
my $vid;
+ my $ua = $self->ua();
$url =~ m|$pattern|;
$url = $1;
$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;
}
}
# Get the XML file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://www.mncast.com/_MovieInfo_/_MovieInfoXML_Tag_v2.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;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::Parser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://www.metacafe.com/watch/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.metacafe.com/watch/%s', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::Parser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://www.myvideo.de/watch/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.myvideo.de/watch/%s', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::UserAgent;
-use HTTP::Cookies;
use HTML::TokeParser;
use Data::Dumper;
my $self = shift;
my $url = shift;
my $pattern = shift;
- my $jar = HTTP::Cookies->new();
- my $ua = LWP::UserAgent->new('agent' => 'Mozilla/5.0');
+ my $ua = $self->ua();
my $content;
my $metadata = {};
my $p;
$metadata->{'DLURL'} = undef;
# Set the cookies necessary to get the video data
- $jar->set_cookie(undef, 'pp', '1', '/', '.redtube.com');
- $ua->cookie_jar($jar);
+ $ua->cookie_jar->set_cookie(undef, 'pp', '1', '/', '.redtube.com');
- unless(defined($r = $ua->get(sprintf("http://www.redtube.com/%s", $2)))) {
+ unless(defined($content = $self->simple_get(sprintf("http://www.redtube.com/%s", $2), $ua))) {
$self->error('Could not download page');
return undef;
}
- # Get the site to extract the title
- $content = $r->decoded_content();
-
$p = HTML::TokeParser->new(\$content);
# Look for the title
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use XML::Simple;
use Data::Dumper;
$metadata->{'DLURL'} = undef;
# Get the XML file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://api.sevenload.com/api/player/id/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://api.sevenload.com/api/player/id/%s', $2)))) {
$self->error('Could not download XML metadata');
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use XML::Simple;
use Data::Dumper;
$metadata->{'DLURL'} = undef;
# Get the XML file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://www.spikedhumor.com/playxml/%s/data.xml', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.spikedhumor.com/playxml/%s/data.xml', $2)))) {
$self->error('Could not download XML metadata');
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
-use LWP::UserAgent;
use XML::Simple;
use Data::Dumper;
my $content;
my $metadata = {};
my $p = XML::Simple->new();
- my $ua = LWP::UserAgent->new(max_redirect => 0);
+ my $ua = $self->ua();
my $t;
my $dlurl;
my $r;
$metadata->{'DLURL'} = undef;
# Get the XML file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://www.veoh.com/rest/v2/execute.xml?apiKey=5697781E-1C60-663B-FFD8-9B49D2B56D36&method=veoh.search.search&type=video&maxResults=1&permalink=%s&contentRatingId=1&', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.veoh.com/rest/v2/execute.xml?apiKey=5697781E-1C60-663B-FFD8-9B49D2B56D36&method=veoh.search.search&type=video&maxResults=1&permalink=%s&contentRatingId=1&', $2), $ua))) {
$self->error('Could not download XML metadata');
return undef;
}
# We now have to fetch the dlurl to get the redirect target after it,
# because the dlurl itself must be called with the right referer set
+ $ua->max_redirect(0);
$r = $ua->get($dlurl, 'referer' => 'http://www.veoh.com');
unless ($r->is_redirect) {
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::UserAgent;
use XML::Simple;
use Digest::MD5 qw(md5_hex);
use Data::Dumper;
my $dlpath;
my $timestamp;
my $hash;
- my $ua = LWP::UserAgent->new(agent => 'Mozilla');
$url =~ m|$pattern|;
$url = $1;
$metadata->{'DLURL'} = undef;
# Get the XML file containing the video metadata
- $content = $ua->get(sprintf('http://www.vimeo.com/moogaloop/load/clip:%s', $2));
- unless ($content->is_success()) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.vimeo.com/moogaloop/load/clip:%s', $2)))) {
$self->error('Could not download XML metadata');
return undef;
}
- $content = $content->decoded_content();
-
unless(defined($t = $p->XMLin($content, KeepRoot => 1))) {
$self->error('Could not parse XML metadata');
return undef;
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use MIME::Base64;
use HTML::Parser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get(sprintf('http://www.wimp.com/%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://www.wimp.com/%s', $2)))) {
$self->error('Could not download %s', $url);
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use XML::Simple;
use HTML::Parser;
use Data::Dumper;
my $p = XML::Simple->new();
my $t;
my @accum;
+ my $ua = $self->ua();
$url =~ m|$pattern|;
$url = $1;
$metadata->{'DLURL'} = undef;
# Get the XML file containing the video metadata
- unless(defined($content = LWP::Simple::get(sprintf('http://cosmos.bcst.yahoo.com/up/yep/process/getPlaylistFOP.php?node_id=%s', $2)))) {
+ unless(defined($content = $self->simple_get(sprintf('http://cosmos.bcst.yahoo.com/up/yep/process/getPlaylistFOP.php?node_id=%s', $2), $ua))) {
$self->error('Could not download XML metadata');
return undef;
}
# The XML does not contain the title of the video, for
# reasons possibly known to some jerk at yahoo.
# So we'll have to parse the actual HTML, too.
- unless(defined($content = LWP::Simple::get($url))) {
+ unless(defined($content = $self->simple_get($url, $ua))) {
$self->error('Could not download HTML');
return undef;
}
use videosite::GrabberBase;
@ISA = qw(videosite::GrabberBase);
-use LWP::Simple qw(!get);
use HTML::TokeParser;
use Data::Dumper;
$metadata->{'TITLE'} = undef;
$metadata->{'DLURL'} = undef;
- unless(defined($content = LWP::Simple::get($url))) {
+ unless(defined($content = $self->simple_get($url))) {
$self->error('Could not download %s', $url);
return undef;
}