Class: Btjunkie
- Inherits:
-
Object
- Object
- Btjunkie
- Defined in:
- lib/btjunkie.rb
Class Method Summary collapse
Instance Method Summary collapse
- #category(what) ⇒ Object
- #cookies(cookies) ⇒ Object
- #find_by_details(url) ⇒ Object
-
#initialize ⇒ Btjunkie
constructor
A new instance of Btjunkie.
- #page(page) ⇒ Object
- #results ⇒ Object
Constructor Details
#initialize ⇒ Btjunkie
Returns a new instance of Btjunkie.
9 10 11 12 13 14 |
# File 'lib/btjunkie.rb', line 9 def initialize @page = 1 @categories = { :movies => "http://btjunkie.org/browse/Video?o=72&t=1&s=1&p=<PAGE>" } end |
Class Method Details
Instance Method Details
#category(what) ⇒ Object
24 25 26 |
# File 'lib/btjunkie.rb', line 24 def category(what) tap { @url = @categories[what] } end |
#cookies(cookies) ⇒ Object
20 21 22 |
# File 'lib/btjunkie.rb', line 20 def () tap { @cookies = } end |
#find_by_details(url) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/btjunkie.rb', line 36 def find_by_details(url) doc = content(url) if title = doc.at_css(".Wht font") title = title.content.strip else title = "" end BtjunkieContainer::Torrent.new({ :torrent => doc.to_s.match(/(http.+?\.torrent)/i).to_a[1], :details => url.to_s.gsub("http://btjunkie.org", ""), :title => title, :seeders => doc.at_css("#main").to_s.match(/([^>][\d,]+) seeds/).to_a[1].to_s.gsub(/[^\d]+/, "") }) end |
#page(page) ⇒ Object
16 17 18 |
# File 'lib/btjunkie.rb', line 16 def page(page) tap { @page = page } end |
#results ⇒ Object
28 29 30 |
# File 'lib/btjunkie.rb', line 28 def results @_torrents ||= scrape end |