From cc354191307da34e35cafa7279dd276bdc1fe427 Mon Sep 17 00:00:00 2001 From: Robert Gerus Date: Mon, 10 Mar 2014 09:12:56 +0100 Subject: [PATCH] brainfart #3 --- plugins/scrape.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/scrape.rb b/plugins/scrape.rb index 9fd8d8c..416df5c 100644 --- a/plugins/scrape.rb +++ b/plugins/scrape.rb @@ -8,8 +8,8 @@ DataMapper.setup(:default, Config[:scrape][:db]) module Scrape def self.download(uri) - ext = "." + word.sub(/.*[.]([^.]*)/, '\1') if word.match(/[^.]+[.][^.]+/) - content = open(word).read + ext = "." + uri.sub(/.*[.]([^.]*)/, '\1') if uri.match(/[^.]+[.][^.]+/) + content = open(uri).read md5 = Digest::MD5.hexdigest(content) File.open(Config[:scrape][:basepath] + md5 + ext, 'w') do |file| file.write(content)