class Dumper::Profiles::Multiplayer

Public Instance Methods

dump(url, path, from, to) click to toggle source
# 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