summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2014-04-01 19:13:37 (GMT)
committerChristian Pointner <equinox@helsinki.at>2014-04-01 19:13:37 (GMT)
commite411344b226f8677cff12bda98991818be342e8a (patch)
tree042ea3ca93c625b6bf6613a96794813e95c2edef
parentff2a7bdbd742ee0417cc36102e60d11bf6658f3a (diff)
fixed https urls change for democracy now!
-rw-r--r--debian/changelog6
-rwxr-xr-xrhimport-dn18
2 files changed, 18 insertions, 6 deletions
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;