]> git.pld-linux.org Git - packages/clive.git/blame - clive-reporter.patch
- updated for 2.1.10
[packages/clive.git] / clive-reporter.patch
CommitLineData
75b3b1fb 1--- clive-2.1.10/clive~ 2009-04-27 11:29:24.000000000 +0200
2+++ clive-2.1.10/clive 2009-04-27 11:30:52.000000000 +0200
3@@ -88,6 +88,7 @@
94810194 4 IsDmotion => qr|dailymotion.com|i,
75b3b1fb 5 IsCctv => qr|tv.cctv.com|i,
94810194 6 IsDelfi => qr|.delfi.|i,
7+ IsReporter => qr|www.reporter.ee|i,
8 );
1b2ddcae 9
75b3b1fb 10 my @re_hosts_arr = (
11@@ -101,6 +102,7 @@
12 [$re_hosts{IsDmotion}, \&handle_dmotion],
13 [$re_hosts{IsCctv}, \&handle_cctv],
14 [$re_hosts{IsDelfi}, \&handle_delfi],
15+ [$re_hosts{IsReporter}, \&handle_reporter],
16 );
17
1b2ddcae 18 # Parse config
67a1036f 19@@ -369,6 +372,14 @@
e8c6b415
ER
20 $content_ok = 1;
21 }
22 }
67a1036f 23+ # Reporter returns "flv-application/octet-stream"
e8c6b415
ER
24+ } elsif ( $content_type =~ m!application/octet-stream! ) {
25+ if ( $entry{page_url} =~ /$re_hosts{IsReporter}/ ) {
26+ if ( $opts{format} eq "flv" ) {
27+ $entry{file_suffix} = 'flv';
28+ $content_ok = 1;
29+ }
30+ }
31 }
32 $errmsg = "expected different content-type, "
67a1036f 33 . "received \"$content_type\"" unless $content_ok;
94810194 34@@ -1061,6 +1062,28 @@
67a1036f 35 return ($xurl, $id);
e8c6b415
ER
36 }
37
38+sub handle_reporter {
39+ my ($response_ref, $response_fh) = @_;
40+
41+ my %re = (
67a1036f
ER
42+ # http://www.reporter.ee/index.php/2008/04/21/soiduopetaja-vorpis-poiste-nupeldamisest-videoklippe/
43+ GrabVideoPrefix => qr|obj\s+=\s+{type:"video",file:"(\w+://[^"]+)|,
44+ GrabVideoID => qr|attributes\s+=\s+{id:\s+"video([^"]+)"|,
e8c6b415
ER
45+ );
46+
67a1036f 47+ my $xurl;
e8c6b415
ER
48+ my $id = $1 if $$response_ref =~ /$re{GrabVideoID}/;
49+ my $prefix = $1 if $$response_ref =~ /$re{GrabVideoPrefix}/;
50+
67a1036f 51+ if ($id and $prefix) {
e8c6b415 52+ $xurl = $prefix . $id . '.flv';
67a1036f 53+ } else {
e8c6b415
ER
54+ print STDERR "error: url not found\n";
55+ }
56+
57+ return ($xurl, $id);
58+}
94810194 59+
e8c6b415
ER
60 # Subroutines: Progress
61 # NOTE: the 'dot' progress copies much from wget.
94810194 62
This page took 0.116305 seconds and 4 git commands to generate.