Class: WaybackArchiver::WaybackMachine
- Inherits:
-
Object
- Object
- WaybackArchiver::WaybackMachine
- Defined in:
- lib/wayback_archiver/adapters/wayback_machine.rb
Overview
WaybackMachine adapter
Constant Summary collapse
- BASE_URL =
Wayback Machine base URL.
'https://web.archive.org/save/'.freeze
Class Method Summary collapse
-
.call(url) ⇒ ArchiveResult
Send URL to Wayback Machine.
Class Method Details
.call(url) ⇒ ArchiveResult
Send URL to Wayback Machine.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wayback_archiver/adapters/wayback_machine.rb', line 15 def self.call(url) request_url = "#{BASE_URL}#{url&.strip}" response = Request.get(request_url, follow_redirects: false) WaybackArchiver.logger.info "Posted [#{response.code}, #{response.}] #{url}" ArchiveResult.new( url, code: response.code, request_url: response.uri, response_error: response.error ) rescue Request::Error => e WaybackArchiver.logger.error "Failed to archive #{url}: #{e.class}, #{e.}" ArchiveResult.new(url, error: e) end |