Replace exact match by exact url

This commit is contained in:
hartator 2017-06-11 21:53:13 -05:00
parent 4eca581257
commit 246441ff17
2 changed files with 7 additions and 7 deletions

View File

@ -16,13 +16,13 @@ class WaybackMachineDownloader
VERSION = "2.0.0" VERSION = "2.0.0"
attr_accessor :base_url, :exact_match, :directory, attr_accessor :base_url, :exact_url, :directory,
:from_timestamp, :to_timestamp, :only_filter, :exclude_filter, :from_timestamp, :to_timestamp, :only_filter, :exclude_filter,
:all, :maximum_pages, :threads_count :all, :maximum_pages, :threads_count
def initialize params def initialize params
@base_url = params[:base_url] @base_url = params[:base_url]
@exact_match = params[:exact_match] @exact_url = params[:exact_url]
@directory = params[:directory] @directory = params[:directory]
@from_timestamp = params[:from_timestamp].to_i @from_timestamp = params[:from_timestamp].to_i
@to_timestamp = params[:to_timestamp].to_i @to_timestamp = params[:to_timestamp].to_i
@ -86,7 +86,7 @@ class WaybackMachineDownloader
snapshot_list_to_consider = "" snapshot_list_to_consider = ""
snapshot_list_to_consider += get_raw_list_from_api(@base_url, nil) snapshot_list_to_consider += get_raw_list_from_api(@base_url, nil)
print "." print "."
unless @exact_match unless @exact_url
@maximum_pages.times do |page_index| @maximum_pages.times do |page_index|
snapshot_list = get_raw_list_from_api(@base_url + '/*', page_index) snapshot_list = get_raw_list_from_api(@base_url + '/*', page_index)
break if snapshot_list.empty? break if snapshot_list.empty?

View File

@ -39,13 +39,13 @@ class WaybackMachineDownloaderTest < Minitest::Test
assert_equal file_expected, @wayback_machine_downloader.get_file_list_by_timestamp[-2] assert_equal file_expected, @wayback_machine_downloader.get_file_list_by_timestamp[-2]
end end
def test_without_exact_match def test_without_exact_url
@wayback_machine_downloader.exact_match = false @wayback_machine_downloader.exact_url = false
assert @wayback_machine_downloader.get_file_list_curated.size > 1 assert @wayback_machine_downloader.get_file_list_curated.size > 1
end end
def test_exact_match def test_exact_url
@wayback_machine_downloader.exact_match = true @wayback_machine_downloader.exact_url = true
assert_equal 1, @wayback_machine_downloader.get_file_list_curated.size assert_equal 1, @wayback_machine_downloader.get_file_list_curated.size
end end