brainfart #3
parent
180b5332de
commit
cc35419130
|
@ -8,8 +8,8 @@ DataMapper.setup(:default, Config[:scrape][:db])
|
||||||
|
|
||||||
module Scrape
|
module Scrape
|
||||||
def self.download(uri)
|
def self.download(uri)
|
||||||
ext = "." + word.sub(/.*[.]([^.]*)/, '\1') if word.match(/[^.]+[.][^.]+/)
|
ext = "." + uri.sub(/.*[.]([^.]*)/, '\1') if uri.match(/[^.]+[.][^.]+/)
|
||||||
content = open(word).read
|
content = open(uri).read
|
||||||
md5 = Digest::MD5.hexdigest(content)
|
md5 = Digest::MD5.hexdigest(content)
|
||||||
File.open(Config[:scrape][:basepath] + md5 + ext, 'w') do |file|
|
File.open(Config[:scrape][:basepath] + md5 + ext, 'w') do |file|
|
||||||
file.write(content)
|
file.write(content)
|
||||||
|
|
Loading…
Reference in New Issue