SOURCES: slimrat-youtube_plugin.patch (NEW) - new youtube patch
duddits
duddits at pld-linux.org
Fri Jan 23 14:14:14 CET 2009
Author: duddits Date: Fri Jan 23 13:14:14 2009 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- new youtube patch
---- Files affected:
SOURCES:
slimrat-youtube_plugin.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: SOURCES/slimrat-youtube_plugin.patch
diff -u /dev/null SOURCES/slimrat-youtube_plugin.patch:1.1
--- /dev/null Fri Jan 23 14:14:14 2009
+++ SOURCES/slimrat-youtube_plugin.patch Fri Jan 23 14:14:08 2009
@@ -0,0 +1,38 @@
+diff -pruN slimrat-0.9.2.orig/plugins/YouTube.pm slimrat-0.9.2/plugins/YouTube.pm
+--- slimrat-0.9.2.orig/plugins/YouTube.pm 2008-12-31 13:13:29.000000000 +0100
++++ slimrat-0.9.2/plugins/YouTube.pm 2008-12-31 13:23:34.000000000 +0100
+@@ -5,8 +5,7 @@
+ package YouTube;
+ use Term::ANSIColor qw(:constants);
+ $Term::ANSIColor::AUTORESET = 1;
+-use LWP::UserAgent;
+-my $ua = LWP::UserAgent->new;
++use LWP::Simple;
+ #use WWW::Mechanize;
+ #my $mech = WWW::Mechanize->new(agent => 'SlimRat' ); ##############
+
+@@ -15,16 +14,18 @@ my $ua = LWP::UserAgent->new;
+ # -1: dead
+ # 0: don't know
+ sub check {
+- my $res = $ua->get(shift);
+- return 1 if ($res->is_success && $res->content()!~m#<div class="errorBox">#);
++ my $res = get($_);
++ return 1 if (defined $res && $res!~m#<div class="errorBox">#);
+ return -1;
+ }
+
+ sub download {
+- my $paramChar = '[\w\d-_]';
+- my ($v) = shift =~ m#\Wv=($paramChar+)#;
+- my ($t) = $ua->head("http://www.youtube.com/v/$v")->{_previous}->header('location') =~ m#\Wt=($paramChar+)#;
+- return "http://www.youtube.com/get_video.php?video_id=$v&t=$t";
++ my $content = get($_);
++ $content =~ /swfArgs.*"video_id"\s*:\s*"(.*?)".*"t"\s*:\s*"(.*?)".*/;
++ #$content =~ /"video_id"\s*:\s*"(.*?)"\s*,.*,\s*"t"\s*:\s*"(.*?)",/;
++ my $video_id = $1;
++ my $t = $2;
++ return "http://www.youtube.com/get_video?video_id=$video_id&t=$t";
+ }
+
+ Plugin::register(__PACKAGE__,"^[^/]+//[^.]*\.?youtube\.com/watch[?]v=.+");
================================================================
More information about the pld-cvs-commit
mailing list