Class: Dumper::Profiles::Multiplayer

Inherits:
Profile
  • Object
show all
Defined in:
lib/dumper/profiles/multiplayer.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
39
# File 'lib/dumper/profiles/multiplayer.rb', line 24

def dump(url, path, from, to)
  from -= 1
  to   -= 1 if to >= 1

  url.gsub! /\/giochi\//, '/immagini/galleria/'
  url.gsub! '.html', ''
  gallery = JSON.parse open("#{url}?from=#{from}").read

  to -= from if to >= 1
  
  gallery['objects'].reverse[0..to].each { |image|
    @pool.process {
      Dumper.get path, image['image']
    }
  }
end