Module: PirateBayParser::Parser
- Defined in:
- lib/manager/sites/piratebay_parser.rb
Overview
Parse values from html
Constant Summary collapse
- BASEURL =
'https://thepiratebay.mn'
Class Method Summary collapse
- .leechers(div) ⇒ Object
- .seeders(div) ⇒ Object
- .size(div) ⇒ Object
- .torrent_name(div) ⇒ Object
- .torrent_url(div) ⇒ Object
Class Method Details
.leechers(div) ⇒ Object
21 22 23 24 |
# File 'lib/manager/sites/piratebay_parser.rb', line 21 def self.leechers(div) links = div.search(".//td[@align='right']") links[1].content if !links.nil? && !links[1].nil? end |
.seeders(div) ⇒ Object
16 17 18 19 |
# File 'lib/manager/sites/piratebay_parser.rb', line 16 def self.seeders(div) links = div.search(".//td[@align='right']") links[0].content if !links.nil? && !links[0].nil? end |
.size(div) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/manager/sites/piratebay_parser.rb', line 26 def self.size(div) links = div.search(".//font[@class='detDesc']") value = '' links.each do |link| value = link.content[/#{'Size '}(.*?)#{', '}/m, 1] end value end |
.torrent_name(div) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/manager/sites/piratebay_parser.rb', line 44 def self.torrent_name(div) links = div.search(".//a[@class='detLink']") value = '' links.each do |link| value = link.content end value end |
.torrent_url(div) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/manager/sites/piratebay_parser.rb', line 35 def self.torrent_url(div) links = div.search(".//a[@title='Download this torrent using magnet']") value = '' links.each do |link| value = link.attributes['href'] end BASEURL + value end |