mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-17 17:56:44 +00:00
Taking care of empty responses
fixes "unexpected token at ''" appearing after fetching a list of snapshots
This commit is contained in:
parent
7142be5c16
commit
019534794c
@ -10,7 +10,9 @@ module ArchiveAPI
|
||||
|
||||
begin
|
||||
response = http.get(request_url)
|
||||
json = JSON.parse(response.body)
|
||||
body = response.body.to_s.strip
|
||||
return [] if body.empty?
|
||||
json = JSON.parse(body)
|
||||
|
||||
# Check if the response contains the header ["timestamp", "original"]
|
||||
json.shift if json.first == ["timestamp", "original"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user