The unofficial API for btjunkie.org
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec Testing #results for empty string May 23, 2011
.gitignore
.rspec Adding page method Apr 27, 2011
Gemfile
Rakefile
Readme.md Adding #find_by_details to readme May 23, 2011
btjunkie.gemspec

Readme.md

Btjunkie

Unofficial API for Btjunkie.

How to use

Fetch torrents from the video section.

Most recent

Btjunkie.category(:movies)

Specify a page

Btjunkie.page(12).category(:movies)

Default is 1.

Cookies

Btjunkie requires that you pass some cookies to fetch there data. You can easily do that by specifying the sessid.

Btjunkie.cookies({
  sessid: "1212lksdjfkj3lkeda090w83922af6b"
})

Get info about a url

You can easily get detailed info about a torrent using the find_by_details method.

url = "http://btjunkie.org/torrent/Pirates-of-the-Caribbean-4-2011-XViD-MEM-ENG-AUDIO/3952ef0859f08bbc7b63c97c51bd9a02e154e0c38026"
torrent = Btjunkie.find_by_details(url)
torrent.title # => Pirates of the Caribbean 4 2011 XViD- MEM [ENG AUDIO]

The find_by_details method returns a Torrent object.

Data to work with

As soon as the results method is applied to the query a request to Btjunkie is made. The results method returns a list of Torrent object with the following methods.

  • title (String) The title.
  • details (String) The url to the details page.
  • torrent (String) The url. This should be a direct link to the torrent.
  • tid (String) The tid method, also known as torrent id is a truly unique identifier for all torrents. It is generated using a MD5 with the torrent domain and the id method as a seed.
  • torrent_id (String) The same as the tid method.
  • dead? (Boolean) Check to see if the torrent has no seeders. If it has no seeders, then dead? will be true.
  • id (Fixnum) An unique id for the torrent. The id is only unique for this specific torrent, not all torrents.
  • seeders (Fixnum) The amount of seeders.
  • subtitle (Undertexter) The subtitle for the torrent. Takes one argument, the language for the subtitle. Default is :english. Read more about it here.
  • movie (MovieSearcher) Read more about the returned object at the MovieSearcher project page.
  • valid? (Boolean) Is the torrent valid? Does it contain the correct value for #id, #torrent and #details?
torrents = Btjunkie.category(:movies).results
puts torrents.class       # => Array
puts torrents.first.class # => BtjunkieContainer::Torrent

How do install

[sudo] gem install btjunkie

Requirements

Btjunkie is tested in OS X 10.6.7 using Ruby 1.8.7, 1.9.2.

License

Btjunkie is released under the MIT license.