class Dumper::Profiles::MangaEden
Public Instance Methods
dump(url, path, from, to)
click to toggle source
# File lib/dumper/profiles/mangaeden.rb, line 24 def dump(url, path, from, to) from -= 1 to -= 1 if to >= -1 Nokogiri::HTML(open(url)).xpath('//a[@class="chapterLink"]').reverse[from..to].each { |p| i = 1 dir = File.join path, "#{p.children[1].text} - #{p.children[3].text.sanitize_filename}" Dir.mkdir(dir) unless File.directory? dir page = Nokogiri::HTML open("http://www.mangaeden.com#{p['href']}") Dumper.get dir, page.at_xpath('//img[@id="mainImg"]/@src'), { filename: '1.png' } i += 1 page.xpath('//a[@class="ui-state-default"]').each { |q| next unless q.text.numeric? Nokogiri::HTML(open("http://www.mangaeden.com#{q['href']}")).xpath('//img[@id="mainImg"]/@src').each { |r| @pool.process { Dumper.get dir, r, { filename: "#{q.text.to_i}.png" } } } } } end