From 9da87bfa74f6a856f732fde2a5318077af196283 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Tue, 8 Jun 2021 07:59:38 +0800 Subject: [PATCH] Make URI#open cross Ruby versions compatible Inspired-by: commit 30475c5c9e1d92d63b75dc5f22a40dd16c1aa23a --- lib/wayback_machine_downloader.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/wayback_machine_downloader.rb b/lib/wayback_machine_downloader.rb index 81c1d2e..5406e47 100644 --- a/lib/wayback_machine_downloader.rb +++ b/lib/wayback_machine_downloader.rb @@ -268,7 +268,7 @@ class WaybackMachineDownloader structure_dir_path dir_path open(file_path, "wb") do |file| begin - URI.open("https://web.archive.org/web/#{file_timestamp}id_/#{file_url}", "Accept-Encoding" => "plain") do |uri| + URI("https://web.archive.org/web/#{file_timestamp}id_/#{file_url}").open("Accept-Encoding" => "plain") do |uri| file.write(uri.read) end rescue OpenURI::HTTPError => e