Hello again (last time, I hope *g*),
attached you'll find an improved version of the initial patch, which is also
capable of fetching the best quality (if requested by the user).
Otherwise the module fetches the video in the quality specified by the URL.

Kind regards,
Kai



-- 

Kai Wasserbäch (Kai Wasserbaech)

E-Mail: deb...@carbon-project.org
Jabber (debianforum.de): Drizzt
URL: http://wiki.debian.org/C%C3%B9ran
GnuPG: 0xE1DE59D2      0600 96CE F3C8 E733 E5B6 1587 A309 D76C E1DE 59D2
(http://pgpkeys.pca.dfn.de/pks/lookup?search=0xE1DE59D2&fingerprint=on&hash=on&op=vindex)
diff -Naur clive-2.2.7.orig/lib/clive/Host/Bliptv.pm clive-2.2.7/lib/clive/Host/Bliptv.pm
--- clive-2.2.7.orig/lib/clive/Host/Bliptv.pm	1970-01-01 01:00:00.000000000 +0100
+++ clive-2.2.7/lib/clive/Host/Bliptv.pm	2009-11-19 21:56:20.000000000 +0100
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+###########################################################################
+# clive, command line video extraction utility.
+#
+# Copyright © 2009 Kai Wasserbäch <deb...@carbon-project.org>
+#
+# This file is part of clive.
+#
+# clive is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option)
+# any later version.
+#
+# clive is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+###########################################################################
+package clive::Host::Bliptv;
+
+use warnings;
+use strict;
+
+sub new {
+    return bless( {}, shift );
+}
+
+sub parsePage {
+    my ( $self, $content, $props ) = @_;
+
+    $$props->video_host("bliptv");
+
+    my %re = ( id =>
+            qr|player\.setPermalinkUrl\("http://blip\.tv/file/view/(.*?)\?referrer=blip.tv&source=1"\);|,
+            xurl =>
+            qr|player\.setPrimaryMediaUrl\("(.*?)"\);|,
+    );
+
+    my $tmp;
+    if ( clive::Util::matchRegExps( \%re, \$tmp, $content ) == 0 ) {
+            my $config = clive::Config->instance->config;
+            my $xurl;
+
+            # In case we want the best quality
+            if ( $config->{format} eq "best" ) {
+                    use HTML::TokeParser;
+                    my $parser = HTML::TokeParser->new($content);
+                    
+                    while (my $token = $parser->get_tag("option")) {
+                            my $value = $token->[1]{value} || "-";
+                            my $text  = $parser->get_trimmed_text("/option");
+                            if( $value =~ /^\/file\/(.*?)$/ and 
+                                    $text =~ /^Source(.*?)$/ ) {
+                                    my @filename = split( /=/, $value);
+                                    $xurl = "http://blip.tv/file/get/"; . $filename[1];
+                            }
+                    }
+            }
+            else { # in all other case use the user selected quality (via passed
+                   # URL).
+                    $xurl = $tmp->{xurl};
+            }
+
+            $$props->video_id($tmp->{id});
+            $$props->video_link($xurl);
+
+            return (0);
+    }
+    return (1);
+}
+
+1;
+
+# Your life will set with the sun.
diff -Naur clive-2.2.7.orig/lib/clive/HostFactory.pm clive-2.2.7/lib/clive/HostFactory.pm
--- clive-2.2.7.orig/lib/clive/HostFactory.pm	2009-11-19 19:52:19.000000000 +0100
+++ clive-2.2.7/lib/clive/HostFactory.pm	2009-11-19 19:56:51.000000000 +0100
@@ -46,6 +46,7 @@
     [ "Clipfish",  qr|clipfish.de|i,  "flv" ],
     [ "Funnyhub",  qr|funnyhub.com|i, "flv" ],
     [ "Myubo",     qr|myubo.com|i,    "flv" ],
+    [ "Bliptv",    qr|blip.tv|i,      "flv|mov|3gp|m4v" ],
 );
 
 sub new {

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to