Class: HailHydra::TPB

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

Overview

The TPB class provides the main client to connect to and scrape the results.

Instance Method Summary collapse

Constructor Details

#initialize(domain = "https://apibay.org") ⇒ TPB

remember the domain name and get the cookie to use from the TPB server



12
13
14
# File 'lib/client.rb', line 12

def initialize domain="https://apibay.org"
  @domain = domain
end

Instance Method Details

#search(query) ⇒ Object

search torrents



17
18
19
20
21
# File 'lib/client.rb', line 17

def search query
  get = make_search_request query
  raise "Invalid response: #{get.response.code}" unless get.response.code == "200"
  return parse_search_results JSON.parse(get.response.body) 
end