Skip to content

Commit

Permalink
Update archive_api.rb to use Net::HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiftaDeband committed Feb 8, 2024
1 parent c098656 commit b813813
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/wayback_machine_downloader/archive_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

module ArchiveAPI

def get_raw_list_from_api url, page_index
def get_raw_list_from_api url, page_index, http
request_url = URI("https://web.archive.org/cdx/search/xd")
params = [["output", "json"], ["url", url]]
params += parameters_for_api page_index
request_url.query = URI.encode_www_form(params)

begin
json = JSON.parse(URI(request_url).open.read)
json = JSON.parse(http.get(URI(request_url)).body)
if (json[0] <=> ["timestamp","original"]) == 0
json.shift
end
Expand Down

0 comments on commit b813813

Please sign in to comment.