mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-18 18:26:43 +00:00
Merge branch 'pr/82'
This commit is contained in:
commit
6e3986b875
@ -201,7 +201,8 @@ class WaybackMachineDownloader
|
|||||||
end
|
end
|
||||||
|
|
||||||
def download_file file_remote_info
|
def download_file file_remote_info
|
||||||
file_url = file_remote_info[:file_url]
|
current_encoding = "".encoding
|
||||||
|
file_url = file_remote_info[:file_url].encode(current_encoding)
|
||||||
file_id = file_remote_info[:file_id]
|
file_id = file_remote_info[:file_id]
|
||||||
file_timestamp = file_remote_info[:timestamp]
|
file_timestamp = file_remote_info[:timestamp]
|
||||||
file_path_elements = file_id.split('/')
|
file_path_elements = file_id.split('/')
|
||||||
|
|||||||
@ -90,4 +90,18 @@ class WaybackMachineDownloaderTest < Minitest::Test
|
|||||||
assert_equal 69, @wayback_machine_downloader.get_file_list_curated.size
|
assert_equal 69, @wayback_machine_downloader.get_file_list_curated.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Testing encoding conflicts needs a different base_url
|
||||||
|
def test_nonascii_suburls_download
|
||||||
|
@wayback_machine_downloader = WaybackMachineDownloader.new base_url: 'https://en.wikipedia.org/wiki/%C3%84'
|
||||||
|
# Once just for the downloading...
|
||||||
|
@wayback_machine_downloader.download_files
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_nonascii_suburls_already_present
|
||||||
|
@wayback_machine_downloader = WaybackMachineDownloader.new base_url: 'https://en.wikipedia.org/wiki/%C3%84'
|
||||||
|
# ... twice to test the "is already present" case
|
||||||
|
@wayback_machine_downloader.download_files
|
||||||
|
@wayback_machine_downloader.download_files
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user