Class: TorrentFinder::Adapters::NyaaAdapter
- Defined in:
- lib/torrent-finder/adapters/nyaa_adapter.rb
Class Method Summary collapse
-
.name ⇒ Object
name of the adapter.
Instance Method Summary collapse
-
#list(page = 0) ⇒ Object
list recently available torrent.
-
#search(terms) ⇒ Object
search and return available torrent.
Methods inherited from Adapter
Class Method Details
.name ⇒ Object
name of the adapter
9 10 11 |
# File 'lib/torrent-finder/adapters/nyaa_adapter.rb', line 9 def self.name "nyaa" end |
Instance Method Details
#list(page = 0) ⇒ Object
list recently available torrent
14 15 16 17 18 |
# File 'lib/torrent-finder/adapters/nyaa_adapter.rb', line 14 def list(page=0) url = page == 0 ? "http://www.nyaa.se/" : "http://www.nyaa.se/?offset=#{(page).to_s}" response = HTTParty.get(url) parse_html(response.body) end |
#search(terms) ⇒ Object
search and return available torrent
21 22 23 24 |
# File 'lib/torrent-finder/adapters/nyaa_adapter.rb', line 21 def search(terms) response = HTTParty.get("http://www.nyaa.se/?page=search&term=", :query => {"term" => terms}) parse_html(response.body) end |