master
Robert Gerus 2014-03-10 09:12:56 +01:00
parent 180b5332de
commit cc35419130
1 changed files with 2 additions and 2 deletions

View File

@ -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)