Refactor name.

This commit is contained in:
Darren Cauthon
2014-05-28 07:35:54 -05:00
parent 940cde18bb
commit 93a4efa695

View File

@@ -10,9 +10,10 @@ item = xml.xpath('//item')
item.each do |s|
source = s.at('enclosure')['url'].to_s
next if File.exist? source.split('/').last
File.open("#{source.split('/').last}", "wb") do |file|
puts " downloading " + source.split('/').last
name = source.split('/').last
next if File.exist? name
File.open(name, "wb") do |file|
puts " downloading " + name
file.write open(source).read
end
end