diff --git a/lib/wayback_machine_downloader/archive_api.rb b/lib/wayback_machine_downloader/archive_api.rb index 70e8ff2..4f2effd 100644 --- a/lib/wayback_machine_downloader/archive_api.rb +++ b/lib/wayback_machine_downloader/archive_api.rb @@ -4,9 +4,13 @@ def get_raw_list_from_api url, page_index request_url = "http://web.archive.org/cdx/search/xd?url=" request_url += url request_url += parameters_for_api page_index - request_uri = URI.parse request_url - response = Net::HTTP.get_response request_uri - response.body + + request_uri = URI.parse request_url + Net::HTTP.new('web.archive.org', nil).start { |http| + request = Net::HTTP::Get.new request_uri + response = http.request request + response.body + } end def parameters_for_api page_index @@ -28,4 +32,4 @@ def parameters_for_api page_index parameters end -end \ No newline at end of file +end