]> git.pld-linux.org Git - packages/clive.git/blobdiff - clive-reporter.patch
- update for 2.1.9
[packages/clive.git] / clive-reporter.patch
index 07ddccbb72f44a207bc011d9307ae7cfda4c2030..6f95b4c29a97569796828d06a205330acb29e2e0 100644 (file)
@@ -1,23 +1,63 @@
---- clive-0.4.11/src/clive/parse.py~   2008-04-27 23:11:12.000000000 +0300
-+++ clive-0.4.11/src/clive/parse.py    2008-04-27 23:11:27.000000000 +0300
-@@ -52,6 +52,7 @@
-             ('metacafe.', 'metac', self._parse_metacafe),
-             ('delfi.', 'delfi', self._parse_delfi),
-             ('www.southparkzone.com', 'southparkzone', self._parse_southparkzone),
-+            ('www.reporter.ee', 'reporter', self._parse_reporter),
-         ]
+--- clive-2.1.9/clive~  2009-03-30 12:13:37.000000000 +0200
++++ clive-2.1.9/clive   2009-03-30 12:15:01.000000000 +0200
+@@ -86,6 +86,7 @@
+                  IsEvisor    => qr|evisor.tv|i,
+                  IsDmotion   => qr|dailymotion.com|i,
+                  IsDelfi     => qr|.delfi.|i,
++                IsReporter  => qr|www.reporter.ee|i,
+                );
+
+ # Parse config
+@@ -328,6 +328,8 @@
+         ($xurl, $id) = handle_dmotion($response_ref);
+     } elsif ( $url =~ /$re_hosts{IsDelfi}/ ) {
+        ($xurl, $id) = handle_delfi($response_ref, $response_fh);
++    } elsif ( $url =~ /$re_hosts{IsReporter}/ ) {
++       ($xurl, $id) = handle_reporter($response_ref, $response_fh);
+     }
+     return -1
+         if !$xurl or !$id or !$title;
+@@ -369,6 +372,14 @@
+                         $content_ok = 1;
+                     }
+                 }
++            # Reporter returns "flv-application/octet-stream"
++            } elsif ( $content_type =~ m!application/octet-stream! ) {
++                if ( $entry{page_url} =~ /$re_hosts{IsReporter}/ ) {
++                    if ( $opts{format} eq "flv" ) {
++                        $entry{file_suffix} = 'flv';
++                        $content_ok = 1;
++                    }
++                }
+             }
+             $errmsg = "expected different content-type, "
+                 . "received \"$content_type\"" unless $content_ok;
+@@ -1061,6 +1062,28 @@
+     return ($xurl, $id);
+ }
  
-     ## Parses a video page data (HTML)
-@@ -297,6 +298,12 @@
-         vid = md5.new(str(time.time())).hexdigest()[:8]
-         return (url, vid, low_quality)
-+    def _parse_reporter(self, url, data, low_quality):
-+        # http://www.reporter.ee/index.php/2008/04/21/soiduopetaja-vorpis-poiste-nupeldamisest-videoklippe/
-+        url = self._parse_from_to(data, 'so.addVariable("src", "', '"', skip_from = 1);
-+        vid = md5.new(str(time.time())).hexdigest()[:8]
-+        return (url, vid, low_quality)
++sub handle_reporter {
++    my ($response_ref, $response_fh) = @_;
++
++    my %re = (
++    # http://www.reporter.ee/index.php/2008/04/21/soiduopetaja-vorpis-poiste-nupeldamisest-videoklippe/
++        GrabVideoPrefix => qr|obj\s+=\s+{type:"video",file:"(\w+://[^"]+)|,
++        GrabVideoID     => qr|attributes\s+=\s+{id:\s+"video([^"]+)"|,
++    );
++
++    my $xurl;
++    my $id     = $1 if $$response_ref =~ /$re{GrabVideoID}/;
++    my $prefix = $1 if $$response_ref =~ /$re{GrabVideoPrefix}/;
++
++    if ($id and $prefix) {
++        $xurl = $prefix . $id . '.flv';
++    } else {
++        print STDERR "error: url not found\n";
++    }
++
++    return ($xurl, $id);
++}
 +
-     def _random_vid(self):
-         return md5.new(str(time.time())).hexdigest()[:8]
+ # Subroutines: Progress
+ # NOTE: the 'dot' progress copies much from wget.
  
This page took 0.075716 seconds and 4 git commands to generate.