Class: NnmClub::Torrent

Inherits:
Object
  • Object
show all
Defined in:
lib/nnmClub_api/torrent.rb

Class Method Summary collapse

Class Method Details

.find(torrent_id) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/nnmClub_api/torrent.rb', line 7

def self.find(torrent_id)
  document = Nokogiri::HTML(open(NnmClub::TorrentURL+torrent_id))
  postbody = document.css('.postbody').first
  info = {:content  => postbody.to_html( encoding: "UTF-8" ),
          :image    => postbody.css('var.postImg').empty? ? "nil" : postbody.css('var.postImg').first['title']
  }
  return info
end