1 --- clive-2.1.10/clive~ 2009-04-27 11:14:37.000000000 +0200
2 +++ clive-2.1.10/clive 2009-04-27 11:21:15.000000000 +0200
4 IsEvisor => qr|evisor.tv|i,
5 IsDmotion => qr|dailymotion.com|i,
6 IsCctv => qr|tv.cctv.com|i,
7 + IsDelfi => qr|.delfi.|i,
12 [$re_hosts{IsEvisor}, \&handle_evisor],
13 [$re_hosts{IsDmotion}, \&handle_dmotion],
14 [$re_hosts{IsCctv}, \&handle_cctv],
15 + [$re_hosts{IsDelfi}, \&handle_delfi],
24 + my ($response_ref, $response_fh) = @_;
28 + # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=15218215
29 + GrabVideoboxURL => qr|flv_url:\s*'(.*?)'|,
30 + # videoproject embed
31 + # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=18759038
32 + GrabVideoSalt => qr|_delfiVideoSalt\s*=\s*"([^"]+)";|,
33 + GrabVideoSite => qr|src="(\S+://[^/]+)/js/embed.js"|,
35 + # http://video.delfi.ee/video/CzurzqNz/
36 + GrabVideoURL => qr|\.addVariable\('file',\s*'([^']+)'|,
40 + my $videobox_url = $1 if $$response_ref =~ /$re{GrabVideoboxURL}/;
41 + my $video_salt = $1 if $$response_ref =~ /$re{GrabVideoSalt}/;
42 + my $video_site = $1 if $$response_ref =~ /$re{GrabVideoSite}/;
43 + my $video_url = $1 if $$response_ref =~ /$re{GrabVideoURL}/;
45 + if ($videobox_url) {
46 + $id = $1 if $videobox_url =~ m{/([^/]+)\.flv$};
47 + $xurl = $videobox_url;
49 + } elsif ($video_url) {
50 + $xurl = URI::Escape::uri_unescape($video_url);
51 + $id = $1 if $xurl =~ m{^\S+://[^/]+/v/(.+?)\.flv};
53 + } elsif ($video_salt and $video_site) {
54 + my $url = $video_site . '/video/' . $video_salt . '/';
55 + print "done.\nfetch page ..." unless $opts{quiet};
58 + open my $fh, ">", \$page;
61 + $curl->setopt(CURLOPT_HEADER, 0);
62 + $curl->setopt(CURLOPT_URL, $url);
63 + $curl->setopt(CURLOPT_WRITEDATA, $fh);
65 + my $rc = $curl->perform;
70 + ($xurl, $id) = handle_delfi(\$page);
72 + print STDERR "\nerror: " . $curl->strerror($rc) . " (http/$rc)\n";
75 + print STDERR "error: url not found\n";
78 + return ($xurl, $id);
81 # Subroutines: Progress
82 # NOTE: the 'dot' progress copies much from wget.