git://git.camperquake.de
/
videosite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'per-window-debug' into weechat
[videosite.git]
/
videosite
/
LiveLeakGrabber.pm
diff --git
a/videosite/LiveLeakGrabber.pm
b/videosite/LiveLeakGrabber.pm
index
4e49d44
..
4521f37
100644
(file)
--- a/
videosite/LiveLeakGrabber.pm
+++ b/
videosite/LiveLeakGrabber.pm
@@
-3,12
+3,11
@@
#
# Grabber for liveleak.com
#
# Grabber for liveleak.com
-package LiveLeakGrabber;
+package
videosite::
LiveLeakGrabber;
-use GrabberBase;
-@ISA = qw(GrabberBase);
+use
videosite::
GrabberBase;
+@ISA = qw(
videosite::
GrabberBase);
-use LWP::Simple qw(!get);
use HTML::TokeParser;
use Data::Dumper;
use HTML::TokeParser;
use Data::Dumper;
@@
-16,15
+15,13
@@
use strict;
sub new {
my $class = shift;
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 {
}
sub _parse {
@@
-34,6
+31,7
@@
sub _parse {
my $content;
my $metadata = {};
my $p;
my $content;
my $metadata = {};
my $p;
+ my $ua = $self->ua();
$url =~ m|$pattern|;
$url = $1;
$url =~ m|$pattern|;
$url = $1;
@@
-46,7
+44,7
@@
sub _parse {
$metadata->{'DLURL'} = undef;
# Get the site to extract the title
$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;
}
$self->error('Could not download page');
return undef;
}
@@
-60,7
+58,7
@@
sub _parse {
}
# Get the file containing the video metadata
}
# 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;
}
$self->error('Could not download metadata');
return undef;
}