lib/nnmClub_api/torrent.rb in nnmClub_api-0.1.1 vs lib/nnmClub_api/torrent.rb in nnmClub_api-0.1.2
- old
+ new
@@ -6,10 +6,10 @@
class Torrent
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').first['title']
+ :image => postbody.css('var.postImg').empty? ? "nil" : postbody.css('var.postImg').first['title']
}
return info
end
end
end
\ No newline at end of file