1 --- clive-2.1.3/clive~ 2009-01-20 13:48:45.000000000 +0200
2 +++ clive-2.1.3/clive 2009-01-20 13:49:36.000000000 +0200
4 IsLastfm => qr|\Qlast.fm\E|i,
5 IsLiveleak => qr|\Qliveleak.com\E|i,
6 IsEvisor => qr|\Qevisor.tv\E|i,
7 + IsDelfi => qr|\Q.delfi.\E|i,
8 #IsMetacafe => qr|\Qmetacafe.com\E|i,
12 ($xurl, $id) = handle_liveleak($response_ref, $response_fh);
13 } elsif ( $url =~ /$re_hosts{IsEvisor}/ ) {
14 ($xurl, $id) = handle_evisor($response_ref);
15 + } elsif ( $url =~ /$re_hosts{IsDelfi}/ ) {
16 + ($xurl, $id) = handle_delfi($response_ref, $response_fh);
18 # elsif ( $url =~ /$re_hosts{IsMetacafe}/ ) {
19 # ($xurl, $id) = handle_metacafe($response_ref);
25 + my ($response_ref, $response_fh) = @_;
29 + # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=15218215
30 + GrabVideoboxURL => qr|flv_url:\s*'(.*?)'|,
31 + # videoproject embed
32 + # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=18759038
33 + GrabVideoSalt => qr|_delfiVideoSalt\s*=\s*"([^"]+)";|,
34 + GrabVideoSite => qr|src="(\S+://[^/]+)/js/embed.js"|,
36 + # http://video.delfi.ee/video/CzurzqNz/
37 + GrabVideoURL => qr|\.addVariable\('file',\s*'([^']+)'|,
41 + my $videobox_url = $1 if $$response_ref =~ /$re{GrabVideoboxURL}/;
42 + my $video_salt = $1 if $$response_ref =~ /$re{GrabVideoSalt}/;
43 + my $video_site = $1 if $$response_ref =~ /$re{GrabVideoSite}/;
44 + my $video_url = $1 if $$response_ref =~ /$re{GrabVideoURL}/;
46 + if ($videobox_url) {
47 + $id = $1 if $videobox_url =~ m{/([^/]+)\.flv$};
48 + $xurl = $videobox_url;
50 + } elsif ($video_url) {
51 + $xurl = uri_unescape($video_url);
52 + $id = $1 if $xurl =~ m{^\S+://[^/]+/v/(.+?)\.flv};
54 + } elsif ($video_salt and $video_site) {
55 + my $url = $video_site . '/video/' . $video_salt . '/';
56 + print "done.\nfetch page ..." unless $opts{quiet};
59 + open my $fh, ">", \$page;
62 + $curl->setopt(CURLOPT_HEADER, 0);
63 + $curl->setopt(CURLOPT_URL, $url);
64 + $curl->setopt(CURLOPT_WRITEDATA, $fh);
66 + my $rc = $curl->perform;
71 + ($xurl, $id) = handle_delfi(\$page);
73 + print STDERR "\nerror: " . $curl->strerror($rc) . " (http/$rc)\n";
76 + print STDERR "error: url not found\n";
79 + return ($xurl, $id);
83 # Subroutines: Progress
84 # NOTE: the 'dot' progress copies much from wget.