From e411344b226f8677cff12bda98991818be342e8a Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Tue, 1 Apr 2014 19:13:37 +0000
Subject: fixed https urls change for democracy now!


diff --git a/debian/changelog b/debian/changelog
index 658e01f..7b7aab3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+rhimport (0.3.15-28) unstable; urgency=low
+
+  * fixed url parser for democracy now
+
+ -- Christian Pointner <equinox@helsinki.at>  Tue, 01 Apr 2014 20:12:21 +0200
+
 rhimport (0.3.15-27) unstable; urgency=low
 
   * moved pv from intranet to web
diff --git a/rhimport-dn b/rhimport-dn
index b6847e1..0468dc8 100755
--- a/rhimport-dn
+++ b/rhimport-dn
@@ -29,7 +29,7 @@ use XML::Feed;
 use XML::Feed::Entry;
 use XML::Feed::Content;
 use XML::Feed::Enclosure;
-use File::Fetch;
+use URI::URL;
 use IO::Handle;
 use IPC::Open3;
 
@@ -107,21 +107,27 @@ my $file = "";
 my $out_file = "";
 for my $entry ($files_feed->entries) {
   if($entry->enclosure && $entry->enclosure->type eq "audio/mpeg") {
-    if($entry->enclosure->url =~ /^http:\/\/distro.democracynow.org\/dn([0-9-]+)-1\.mp3$/) {
+    if($entry->enclosure->url =~ /^https?:\/\/.*\.democracynow\.org\/dn([0-9-]+)-1\.mp3$/) {
       next if($yc ne $1);
 
-      my $ff = File::Fetch->new(uri => $entry->enclosure->url);
+      my $url = new URI::URL($entry->enclosure->url);
+      my @path = $url->path_components;
 
       my $current_file = `cat $STAT_FILE`;
-      if($current_file eq $ff->output_file) {
+      if($current_file eq $path[-1]) {
         print "Already downloaded file of day in question\n";
         $dbh->disconnect();
         exit 0;
       }
-      $out_file = $ff->output_file;
+      $out_file = $path[-1];
 
       print $1 . ": downloading " . $entry->enclosure->url . " (" . $entry->enclosure->length . " Bytes) .. ";
-      $file = $ff->fetch( to => '/tmp' ) or die $ff->error;
+
+      $file = "/tmp/" . $out_file;
+      system("wget", "--quiet", "--no-check-certificate", $url, "-O", $file);
+      if( $! != 0) {
+        die "wget returned with error: " . $!;
+      }
       print "ok\n";
 
       last;
-- 
cgit v0.10.2