torrent_api 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -2,3 +2,4 @@
2
2
  v0.0.2 dependencies additions/removals, beginning of a readme
3
3
  v0.0.3 fixed minor issue with 0.0.2
4
4
  v0.0.9 Migrated from tpb to torrent_api (now includes torrent_reactor and demonoid as searches)
5
+ v0.1.0 Fixed Demonoid. Stable performance on :all and :demonoid.
data/README.markdown CHANGED
@@ -21,7 +21,7 @@ Using Nokogiri or Hpricot, it takes a search term (and sometimes a category) and
21
21
 
22
22
  #### Query all torrent websites and work with those torrents
23
23
 
24
- torrents = TorrentApi.new(:all, 'the royal tenenbaums') # buggy as of 0.0.9
24
+ torrents = TorrentApi.new(:all, 'the royal tenenbaums')
25
25
  torrent = torrents.first
26
26
  torrent.name
27
27
  => "The.Royal.Tenenbaums.XviD.DVD-Rip"
@@ -49,14 +49,13 @@ Using Nokogiri or Hpricot, it takes a search term (and sometimes a category) and
49
49
 
50
50
  * TorrentReactor
51
51
  * The Piratey Bay
52
- * Demonoid (still buggy)
52
+ * Demonoid
53
53
 
54
54
  ### How to help
55
55
 
56
56
  Add more torrent sites!
57
57
 
58
58
  ### To do
59
- * Need to fix demonoid. Still buggy with newer movies.
60
59
  * Refactor all three search engines to use a shared torrent model
61
60
  * More search engines!
62
61
  * Need to add/remove dependencies - awesome_print and nokogiri
data/Rakefile CHANGED
@@ -1,8 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('torrent_api', '0.0.9
3
-
4
-
5
- ') do |p|
2
+ Echoe.new('torrent_api', '0.1.0') do |p|
6
3
  p.description = "An API to query popular torrent websites"
7
4
  p.url = "http://www.github.com/hjhart/torrent_api"
8
5
  p.author = "James Hart"
data/lib/demonoid/base.rb CHANGED
@@ -56,18 +56,18 @@ module Demonoid
56
56
 
57
57
  demonoid_row = []
58
58
  demonoid_table = doc.search('.ctable_content_no_pad table tr')
59
- demonoid_table = demonoid_table.select { |row| !(row.search('iframe').count == 1 || row.inner_html =~ /Sponsored links/)}
60
59
  demonoid_table.each_with_index do |row, index|
61
60
  next if (0..3).include? index # skip the first few rows. It's mostly junk.
62
61
  break if index == 154 # end of table
63
-
64
- demonoid_row << row
65
- if index % 3 == 0 # this is the majority of the info
62
+
63
+ if row.search('td').count == 9 # the majority of the information is in this tr
64
+ demonoid_row << row
66
65
  result = Demonoid::Result.new(demonoid_row)
67
- demonoid_row = []
68
66
  @results << result
69
- elsif index % 3 == 1 # this contains the date of birth
70
- elsif index % 3 == 2 #this contains the title and the cateogyr
67
+ demonoid_row = []
68
+ elsif row.search('td').count == 2 # this is a title/category row
69
+ demonoid_row << row
70
+ else # this is probably a date created, or some other row.
71
71
  end
72
72
  end
73
73
 
@@ -3,16 +3,14 @@ module Demonoid
3
3
  attr_accessor :name, :seeds, :leeches, :category, :link, :magnet_link, :status, :size, :date_created, :detail_link
4
4
 
5
5
  def initialize(row = [])
6
- date_string = row[0].search('.added_today').inner_html.match(/Added on (.*)/)
7
- self.date_created = Time.parse(date_string[1]) if date_string
8
- self.name = row[1].search('td')[1].search('a').inner_html
9
- self.detail_link = row[1].search('td')[1].search('a').first.get_attribute('href')
10
- self.link = row[2].search('td')[2].search('a').first.get_attribute('href')
11
- self.magnet_link = row[2].search('td')[2].search('a')[1].get_attribute('href')
12
- self.seeds = row[2].search('td')[6].search('font').inner_html.to_i
13
- self.leeches = row[2].search('td')[7].search('font').inner_html.to_i
6
+ self.name = row[0].search('td')[1].search('a').inner_html
7
+ self.detail_link = row[0].search('td')[1].search('a').first.get_attribute('href')
8
+ self.link = row[1].search('td')[2].search('a').first.get_attribute('href')
9
+ self.magnet_link = row[1].search('td')[2].search('a')[1].get_attribute('href')
10
+ self.seeds = row[1].search('td')[6].search('font').inner_html.to_i
11
+ self.leeches = row[1].search('td')[7].search('font').inner_html.to_i
14
12
 
15
- raw_filesize = row[2].search('td')[3].inner_html
13
+ raw_filesize = row[1].search('td')[3].inner_html
16
14
  self.size = Demonoid::Result.filesize_in_bytes(raw_filesize)
17
15
  end
18
16
 
data/torrent_api.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{torrent_api}
5
- s.version = "0.0.9"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["James Hart"]
9
- s.date = %q{2011-06-24}
9
+ s.date = %q{2011-06-26}
10
10
  s.description = %q{An API to query popular torrent websites}
11
11
  s.email = %q{hjhart@gmail.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "README.markdown", "lib/demonoid/base.rb", "lib/demonoid/result.rb", "lib/demonoid/result_set.rb", "lib/pirate_bay/base.rb", "lib/pirate_bay/categories.rb", "lib/pirate_bay/result.rb", "lib/pirate_bay/result_set.rb", "lib/torrent_api.rb", "lib/torrent_reactor/base.rb", "lib/torrent_reactor/result.rb", "lib/torrent_reactor/result_set.rb"]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 9
9
- version: 0.0.9
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Hart
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-06-24 00:00:00 -07:00
17
+ date: 2011-06-26 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency