Sha256: bc30f1f14cc79fa6c90eb924bfef25f7c8cb5a3e1e427a87905dd5537bf45e75

Contents?: true

Size: 388 Bytes

Versions: 4

Compression:

Stored size: 388 Bytes

Contents

require 'anemone'

module Otacrawler
  class Collector
    def initialize(url)
      @url = url
    end

    def collect(pattern)
      comics = []
      Anemone.crawl(@url, depth_limit: 0) do |anemone|
        anemone.on_every_page do |page|
          page.doc.xpath(pattern).each do |comic|
            comics << comic
          end
        end
      end
      comics
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
otacrawler-0.1.3 lib/otacrawler/collector.rb
otacrawler-0.1.2 lib/otacrawler/collector.rb
otacrawler-0.1.1 lib/otacrawler/collector.rb
otacrawler-0.1.0 lib/otacrawler/collector.rb