Skip to content

Commit 071d208

Browse files
Merge pull request #13 from elidickinson/master
workaround for API only showing html files for some domains (fixes #6)
2 parents f38756d + 1681a12 commit 071d208

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/wayback_machine_downloader/archive_api.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
module ArchiveAPI
55

66
def get_raw_list_from_api(url, page_index, http)
7+
# Automatically append /* if the URL doesn't contain a path after the domain
8+
# This is a workaround for an issue with the API and *some* domains.
9+
# See https://github.com/StrawberryMaster/wayback-machine-downloader/issues/6
10+
if url && !url.match(/^https?:\/\/.*\//i)
11+
url = "#{url}/*"
12+
end
13+
714
request_url = URI("https://web.archive.org/cdx/search/cdx")
815
params = [["output", "json"], ["url", url]] + parameters_for_api(page_index)
916
request_url.query = URI.encode_www_form(params)

0 commit comments

Comments
 (0)