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)