]> git.pld-linux.org Git - packages/clive.git/blob - clive-reporter.patch
- updated for 2.1.10
[packages/clive.git] / clive-reporter.patch
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 @@
4                   IsDmotion   => qr|dailymotion.com|i,
5                   IsCctv      => qr|tv.cctv.com|i,
6                   IsDelfi     => qr|.delfi.|i,
7 +                IsReporter  => qr|www.reporter.ee|i,
8                 );
9
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
18  # Parse config
19 @@ -369,6 +372,14 @@
20                          $content_ok = 1;
21                      }
22                  }
23 +            # Reporter returns "flv-application/octet-stream"
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, "
33                  . "received \"$content_type\"" unless $content_ok;
34 @@ -1061,6 +1062,28 @@
35      return ($xurl, $id);
36  }
37  
38 +sub handle_reporter {
39 +    my ($response_ref, $response_fh) = @_;
40 +
41 +    my %re = (
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([^"]+)"|,
45 +    );
46 +
47 +    my $xurl;
48 +    my $id     = $1 if $$response_ref =~ /$re{GrabVideoID}/;
49 +    my $prefix = $1 if $$response_ref =~ /$re{GrabVideoPrefix}/;
50 +
51 +    if ($id and $prefix) {
52 +        $xurl = $prefix . $id . '.flv';
53 +    } else {
54 +        print STDERR "error: url not found\n";
55 +    }
56 +
57 +    return ($xurl, $id);
58 +}
59 +
60  # Subroutines: Progress
61  # NOTE: the 'dot' progress copies much from wget.
62  
This page took 0.048429 seconds and 3 git commands to generate.