From 355f4c1be78a0282dcf29a632eb5debe868fbe75 Mon Sep 17 00:00:00 2001 From: hartator Date: Thu, 5 Nov 2015 16:18:36 -0600 Subject: [PATCH] Use file timestamp to retrieve files instead of user provided timestamp #14 --- lib/wayback_machine_downloader.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/wayback_machine_downloader.rb b/lib/wayback_machine_downloader.rb index b7618e1..773cbeb 100644 --- a/lib/wayback_machine_downloader.rb +++ b/lib/wayback_machine_downloader.rb @@ -67,6 +67,7 @@ class WaybackMachineDownloader count += 1 file_url = file_remote_info[:file_url] file_id = file_remote_info[:file_id] + file_timestamp = file_remote_info[:timestamp] file_path_elements = file_id.split('/') if file_id == "" dir_path = backup_path @@ -84,6 +85,7 @@ class WaybackMachineDownloader open(file_path, "wb") do |file| begin open("http://web.archive.org/web/#{timestamp}id_/#{file_url}") do |uri| + open("http://web.archive.org/web/#{file_timestamp}id_/#{file_url}") do |uri| file.write(uri.read) end rescue OpenURI::HTTPError => e