Module: ExtratorrentParser::Parser

Defined in:
lib/manager/sites/extratorrent_parser.rb

Overview

Parse values from html

Constant Summary collapse

BASEURL =
'http://extratorrent.cc'

Class Method Summary collapse

Class Method Details

.leechers(div) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/manager/sites/extratorrent_parser.rb', line 25

def self.leechers(div)
  links = div.search(".//td[@class='ly']")
  value = ''
  links.each do |link|
    value = link.content
  end
  value
end

.seeders(div) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/manager/sites/extratorrent_parser.rb', line 16

def self.seeders(div)
  links = div.search(".//td[@class='sy']")
  value = ''
  links.each do |link|
    value = link.content
  end
  value
end

.size(div) ⇒ Object



34
35
36
37
# File 'lib/manager/sites/extratorrent_parser.rb', line 34

def self.size(div)
  links = div.search('.//td')
  links[3].content
end

.torrent_name(div) ⇒ Object



44
45
46
47
48
49
# File 'lib/manager/sites/extratorrent_parser.rb', line 44

def self.torrent_name(div)
  links = div.search('.//a')
  # Get link title and strip Download och torrent from result
  title = links[0].attributes['title'].text
  title.gsub!('Download ', '').gsub!(' torrent', '')
end

.torrent_url(div) ⇒ Object



39
40
41
42
# File 'lib/manager/sites/extratorrent_parser.rb', line 39

def self.torrent_url(div)
  links = div.search('.//a')
  BASEURL + links[0].attributes['href']
end