1 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
2 # licensed under GNU GPL v2
9 @ISA = qw(GrabberBase);
11 use LWP::Simple qw(!get);
20 my $self = $class->SUPER::new();
22 $self->{'NAME'} = 'bliptv';
23 $self->{'PATTERNS'} = ['(http://(?:[-a-zA-Z0-9_.]+\.)*blip.tv/file/(\d+)(?:\?\S+)?)'];
26 $self->_prepare_parameters();
37 my $p = HTML::Parser->new(api_version => 3);
45 $metadata->{'URL'} = $url;
46 $metadata->{'ID'} = $2;
47 $metadata->{'TYPE'} = 'video';
48 $metadata->{'SOURCE'} = $self->{"NAME"};
49 $metadata->{'TITLE'} = undef;
50 $metadata->{'DLURL'} = undef;
52 unless(defined($content = LWP::Simple::get(sprintf('http://blip.tv/file/%s', $2)))) {
53 $self->error('Could not download page');
57 $p->handler(start => \@accum, "tagname, attr");
58 $p->report_tags(qw(div));
62 # Look for the post id in the div tags
64 if (exists($e->[1]->{'pokkariparameters'})) {
65 if ($e->[1]->{'pokkariparameters'} =~ m|posts_id:"(\d+)"|) {
71 unless(defined($xml)) {
72 $self->error("Could not find post id");
76 # Download the XML file containing the stream information
77 unless(defined($content = LWP::Simple::get(sprintf('http://blip.tv/rss/flash/%s', $xml)))) {
78 $self->error('Could not download XML metadata');
82 $xml = XML::Simple::XMLin($content, KeepRoot => 1);
83 $metadata->{'DLURL'} = $xml->{'rss'}->{'channel'}->{'item'}->{'media:group'}->{'media:content'}->{'url'};
84 $metadata->{'TITLE'} = $xml->{'rss'}->{'channel'}->{'item'}->{'media:title'};
86 unless(defined($metadata->{'DLURL'}) && defined($metadata->{'TITLE'})) {
87 $self->error('Could not determine download URL');