]> git.pld-linux.org Git - packages/clive.git/blob - clive-reporter.patch
- rediffed patches. works
[packages/clive.git] / clive-reporter.patch
1 --- clive-2.1.0/clive   2008-12-11 23:42:37.000000000 +0200
2 +++ clive-2.1.0-reporter/clive  2008-12-11 23:43:19.000000000 +0200
3 @@ -85,6 +85,7 @@
4      IsLastfm    => qr|\Qlast.fm\E|i,
5      IsLiveleak  => qr|\Qliveleak.com\E|i,
6      IsDelfi     => qr|\Q.delfi.\E|i,
7 +    IsReporter  => qr|\Qwww.reporter.ee\E|i,
8      #IsMetacafe => qr|\Qmetacafe.com\E|i,
9  );
10  
11 @@ -306,6 +307,8 @@
12          ($xurl, $id) = handle_liveleak($response_ref, $response_fh);
13      } elsif ( $url =~ /$re_hosts{IsDelfi}/ ) {
14          ($xurl, $id) = handle_delfi($response_ref, $response_fh);
15 +    } elsif ( $url =~ /$re_hosts{IsReporter}/ ) {
16 +        ($xurl, $id) = handle_reporter($response_ref, $response_fh);
17      }
18  #    elsif ( $url =~ /$re_hosts{IsMetacafe}/ ) {
19  #        ($xurl, $id) = handle_metacafe($response_ref);
20 @@ -369,6 +372,14 @@
21                          $content_ok = 1;
22                      }
23                  }
24 +            # Reporter returns "flv-application/octet-stream"
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, "
34                  . "received \"$content_type\"" unless $content_ok;
35 @@ -773,6 +784,27 @@
36      return ($xurl, $id);
37  }
38  
39 +sub handle_reporter {
40 +    my ($response_ref, $response_fh) = @_;
41 +
42 +    my %re = (
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([^"]+)"|,
46 +    );
47 +
48 +    my $xurl;
49 +    my $id     = $1 if $$response_ref =~ /$re{GrabVideoID}/;
50 +    my $prefix = $1 if $$response_ref =~ /$re{GrabVideoPrefix}/;
51 +
52 +    if ($id and $prefix) {
53 +        $xurl = $prefix . $id . '.flv';
54 +    } else {
55 +        print STDERR "error: url not found\n";
56 +    }
57 +
58 +    return ($xurl, $id);
59 +}
60  
61  # Subroutines: Progress
62  # NOTE: the 'dot' progress copies much from wget.
This page took 0.066823 seconds and 3 git commands to generate.