Class: IsohuntParser

Inherits:
Object
  • Object
show all
Defined in:
lib/manager/sites/isohunt_parser.rb

Overview

Class responsible for parsing the page response from isohunt

Defined Under Namespace

Modules: Parser

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ IsohuntParser

Returns a new instance of IsohuntParser.



8
9
10
# File 'lib/manager/sites/isohunt_parser.rb', line 8

def initialize(page)
  @page = page
end

Instance Method Details

#main_divsObject



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/manager/sites/isohunt_parser.rb', line 49

def main_divs
  divs = @page.search('.//tr[@data-key]')
  torrents = []
  divs.each do |div|
    torrent_file = Parser.torrent_url(div)
    name = Parser.torrent_name(div)
    size = Parser.size(div)
    seeders = Parser.seeders(div)
    leechers = Parser.leechers(div)
    torrent = Torrent.new(torrent_file, name, size, seeders, leechers)
    torrents.push(torrent)
  end
  torrents
end