torrent_api 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +1 -0
- data/README.markdown +2 -3
- data/Rakefile +1 -4
- data/lib/demonoid/base.rb +7 -7
- data/lib/demonoid/result.rb +7 -9
- data/torrent_api.gemspec +2 -2
- metadata +3 -3
data/CHANGELOG
CHANGED
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')
|
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
|
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
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
|
-
|
65
|
-
|
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
|
-
|
70
|
-
elsif
|
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
|
|
data/lib/demonoid/result.rb
CHANGED
@@ -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
|
-
|
7
|
-
self.
|
8
|
-
self.
|
9
|
-
self.
|
10
|
-
self.
|
11
|
-
self.
|
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[
|
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
|
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-
|
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
|
-
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-
|
17
|
+
date: 2011-06-26 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|