Class: Dumper::Profiles::Booru

Inherits:
Profile
  • Object
show all
Defined in:
lib/dumper/profiles/booru.rb

Instance Method Summary collapse

Instance Method Details

#dump(url, path, from, to) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/dumper/profiles/booru.rb', line 24

def dump(url, path, from, to)
  page = 0

  from.upto(to) { |i|
    notify_observers status: "--- Page #{i} ---"

    Nokogiri::HTML(open("#{url}&pid=#{page}")).xpath('//span[@class="thumb"]').each { |u|
      @pool.process {
        Dumper.get path, u.child.child['src'].gsub(/thumbs/, 'img').gsub(/thumbnails\//, 'images/').gsub(/thumbnail_/, '')
      }
    }

    page += 40
  }
end