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