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. This may be broken into a ‘client’ and ‘parser’ in the future.

Instance Method Summary collapse

Constructor Details

#initialize(domain_name) ⇒ TPB

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



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

def initialize(domain_name)
  @domain = domain_name
  @headers = get_query_headers
end

Instance Method Details

#search(query, pages = 1, orderby = 99) ⇒ Object

search torrents



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

def search(query, pages=1, orderby=99)
  get = make_search_request(query, pages, orderby)
  raise "Invalid response: #{get.response.code}" unless get.response.code == "200"
  return parse_search_results(get.response.body)
end