class Dumper::Profiles::MangaGo
Public Instance Methods
dump(url, path, from, to)
click to toggle source
# File lib/dumper/profiles/mangago.rb, line 24 def dump(url, path, from, to) n_pages = to > 1 ? to : Nokogiri::HTML(open(url)).at_xpath('//div[@class="page_select right"]/div[2]').text.scan(/\d+/).last.to_i from.upto(n_pages) { |i| @pool.process { page = Nokogiri::HTML open(url) url = page.at_xpath('//a[@id="pic_container"]/@href').to_s scan = page.at_xpath('//img[@id="page1"]/@src').to_s[0..-3] Dumper.get path, scan, { referer: url, filename: "#{i}.#{scan.split(?.).last}" } } } end