Sha256: 65abac117fcef3ff30a48976fe1d6af8e986fb68d3e2c67ad2f6ddd5dd510615

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

module ArchiveLister
  class WaybackFile
    attr_reader :urls

    def initialize(urls)
      @urls = urls
    end

    def self.parse(content)
      doc = Nokogiri::HTML(content)
      WaybackFile.new(
        doc.css('td.url a').map do |url_node|
          Addressable::URI.parse(url_node.text).tap do |url|
            url.port = nil if (url.port == 80 && url.scheme == 'http')
            url.port = nil if (url.port == 443 && url.scheme == 'https')
          end
        end
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
archive_lister-0.0.1 lib/archive_lister/wayback_file.rb