Class: TorrentFinder::Adapters::DmhyAdapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/torrent-finder/adapters/dmhy_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

inherited, #name

Class Method Details

.nameObject

name of the adapter



10
11
12
# File 'lib/torrent-finder/adapters/dmhy_adapter.rb', line 10

def self.name
  "dmhy"
end

Instance Method Details

#list(page = 0) ⇒ Object

list recently available torrent



15
16
17
18
19
# File 'lib/torrent-finder/adapters/dmhy_adapter.rb', line 15

def list(page=0)
  url = page == 0 ? "http://share.dmhy.org/" : "http://share.dmhy.org/topics/list/page/#{(page+1).to_s}"
  response = HTTParty.get(url)
  parse_html(response.body)
end

#search(terms) ⇒ Object

search and return available torrent



22
23
24
25
# File 'lib/torrent-finder/adapters/dmhy_adapter.rb', line 22

def search(terms)
  response = HTTParty.get("http://share.dmhy.org/topics/list", :query => {"keyword" => terms})
  parse_html(response.body)
end