torrents 1.0.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/.gitignore +5 -0
- data/.rspec +5 -0
- data/Gemfile +4 -0
- data/README.md +188 -0
- data/Rakefile +2 -0
- data/lib/torrents.rb +140 -0
- data/lib/torrents/container.rb +246 -0
- data/lib/torrents/trackers/the_pirate_bay.rb +51 -0
- data/lib/torrents/trackers/torrentleech.rb +51 -0
- data/lib/torrents/trackers/tti.rb +51 -0
- data/spec/data/the_pirate_bay/details.html +553 -0
- data/spec/data/the_pirate_bay/movies.html +649 -0
- data/spec/data/the_pirate_bay/recent.html +649 -0
- data/spec/data/the_pirate_bay/search.html +650 -0
- data/spec/data/torrentleech/details.html +218 -0
- data/spec/data/torrentleech/movies.html +2104 -0
- data/spec/data/torrentleech/recent.html +2128 -0
- data/spec/data/torrentleech/search.html +2054 -0
- data/spec/data/tti/details.html +335 -0
- data/spec/data/tti/movies.html +450 -0
- data/spec/data/tti/recent.html +450 -0
- data/spec/data/tti/search.html +451 -0
- data/spec/shared_spec.rb +111 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/torrent_spec.rb +186 -0
- data/spec/torrents_spec.rb +231 -0
- data/spec/trackers/the_pirate_bay_spec.rb +58 -0
- data/spec/trackers/torrentleech_spec.rb +67 -0
- data/spec/trackers/tti_spec.rb +68 -0
- data/torrents.gemspec +31 -0
- metadata +180 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
describe Trackers::ThePirateBay do
|
2
|
+
def rest_client(url, type)
|
3
|
+
RestClient.should_receive(:get).with(url, {:timeout => 10, :cookies => nil}).any_number_of_times.and_return(File.read("spec/data/the_pirate_bay/#{type}.html"))
|
4
|
+
end
|
5
|
+
|
6
|
+
def create_torrent
|
7
|
+
Container::Torrent.new({
|
8
|
+
details: "http://thepiratebay.org/torrent/6173093/",
|
9
|
+
torrent: "http://torrents.thepiratebay.org/6173093/value.torrent",
|
10
|
+
title: "The title",
|
11
|
+
tracker: "the_pirate_bay"
|
12
|
+
})
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should only list torrents with the right title" do
|
16
|
+
rest_client("http://thepiratebay.org/search/chuck/0/99/0", "search")
|
17
|
+
torrents = Torrents.the_pirate_bay.search("chuck")
|
18
|
+
|
19
|
+
torrents.results.each do |torrent|
|
20
|
+
torrent.title.should match(/chuck/i)
|
21
|
+
torrent.title.should_not eq(torrent.torrent)
|
22
|
+
end
|
23
|
+
|
24
|
+
torrents.should have(30).results
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should be possible to parse the details view" do
|
28
|
+
rest_client("http://thepiratebay.org/torrent/6173093/", "details")
|
29
|
+
torrent = create_torrent
|
30
|
+
|
31
|
+
torrent.seeders.should eq(9383)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be possible to list recent torrents" do
|
35
|
+
rest_client("http://thepiratebay.org/recent/4", "recent")
|
36
|
+
Torrents.the_pirate_bay.page(5).should have(30).results
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should found 30 recent movies" do
|
40
|
+
rest_client("http://thepiratebay.org/browse/201/4/3", "movies")
|
41
|
+
Torrents.the_pirate_bay.page(5).category(:movies).should have(30).results
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should have a working find_by_details method" do
|
45
|
+
rest_client("http://thepiratebay.org/torrent/6173093/", "details")
|
46
|
+
torrent = Torrents.the_pirate_bay.find_by_details("http://thepiratebay.org/torrent/6173093/")
|
47
|
+
|
48
|
+
torrent.should_not be_dead
|
49
|
+
torrent.seeders.should eq(9383)
|
50
|
+
torrent.tid.should eq("bdc14130add1a279625bf3774c12e89d")
|
51
|
+
torrent.domain.should eq("thepiratebay.org")
|
52
|
+
torrent.imdb.should eq("http://www.imdb.com/title/tt0990407")
|
53
|
+
torrent.imdb_id.should eq("tt0990407")
|
54
|
+
torrent.id.should eq(6173093)
|
55
|
+
torrent.torrent.should eq("http://torrents.thepiratebay.org/6108060/The.Green.Hornet.2010.TS.XViD-T0XiC-iNK.6108060.TPB.torrent")
|
56
|
+
torrent.title.should eq("The.Green.Hornet.2010.TS.XViD-T0XiC-iNK")
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
describe Trackers::Torrentleech do
|
2
|
+
def rest_client(url, type)
|
3
|
+
RestClient.should_receive(:get).with(url, {:timeout => 10, :cookies => cookies}).any_number_of_times.and_return(File.read("spec/data/torrentleech/#{type}.html"))
|
4
|
+
end
|
5
|
+
|
6
|
+
def cookies
|
7
|
+
authentication["cookies"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def authentication
|
11
|
+
YAML::load(File.read("authentication/torrentleech.yaml"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_torrent
|
15
|
+
Container::Torrent.new({
|
16
|
+
details: "http://www.torrentleech.org/torrent/281171",
|
17
|
+
torrent: "http://www.torrentleech.org/download/281171/The.Tourist.2010.720p.BRRip.x264-TiMPE.torrent",
|
18
|
+
title: "The title",
|
19
|
+
tracker: "torrentleech",
|
20
|
+
cookies: cookies
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should only list torrents with the right title" do
|
25
|
+
rest_client("http://www.torrentleech.org/torrents/browse/index/query/dvd/page/1", "search")
|
26
|
+
torrents = Torrents.torrentleech.cookies(cookies).search("dvd")
|
27
|
+
|
28
|
+
torrents.results.each do |torrent|
|
29
|
+
torrent.title.should_not eq(torrent.torrent)
|
30
|
+
torrent.id.should_not eq(0)
|
31
|
+
end
|
32
|
+
|
33
|
+
torrents.should have(100).results
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be possible to parse the details view" do
|
37
|
+
rest_client("http://www.torrentleech.org/torrent/281171", "details")
|
38
|
+
torrent = create_torrent
|
39
|
+
|
40
|
+
torrent.seeders.should eq(49)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be possible to list recent torrents" do
|
44
|
+
rest_client("http://www.torrentleech.org/torrents/browse/index/page/1", "recent")
|
45
|
+
Torrents.torrentleech.cookies(cookies).should have(100).results
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should found 100 recent movies" do
|
49
|
+
rest_client("http://www.torrentleech.org/torrents/browse/index/categories/1,8,9,10,11,12,13,14,15,29/page/1", "movies")
|
50
|
+
Torrents.torrentleech.cookies(cookies).category(:movies).should have(100).results
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should have a working find_by_details method" do
|
54
|
+
rest_client("http://www.torrentleech.org/torrent/281171", "details")
|
55
|
+
torrent = Torrents.torrentleech.cookies(cookies).find_by_details("http://www.torrentleech.org/torrent/281171")
|
56
|
+
|
57
|
+
torrent.should_not be_dead
|
58
|
+
torrent.seeders.should eq(49)
|
59
|
+
torrent.tid.should eq("a64e45a4260991346b632c866e379b06")
|
60
|
+
torrent.domain.should eq("torrentleech.org")
|
61
|
+
torrent.imdb.should eq("http://www.imdb.com/title/tt1243957")
|
62
|
+
torrent.imdb_id.should eq("tt1243957")
|
63
|
+
torrent.id.should eq(281171)
|
64
|
+
torrent.torrent.should eq("http://torrentleech.org/download/281171/The.Tourist.2010.720p.BRRip.x264-TiMPE.torrent")
|
65
|
+
torrent.title.should eq("The Tourist 2010 720p BRRip x264-TiMPE")
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
describe Trackers::Tti do
|
2
|
+
def rest_client(url, type)
|
3
|
+
RestClient.should_receive(:get).with(url, {:timeout => 10, :cookies => cookies}).any_number_of_times.and_return(File.read("spec/data/tti/#{type}.html"))
|
4
|
+
end
|
5
|
+
|
6
|
+
def cookies
|
7
|
+
authentication["cookies"]
|
8
|
+
end
|
9
|
+
|
10
|
+
def authentication
|
11
|
+
YAML::load(File.read("authentication/tti.yaml"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_torrent
|
15
|
+
Container::Torrent.new({
|
16
|
+
details: "http://tti.nu/details.php?id=132470",
|
17
|
+
torrent: "http://tti.nu/download2.php/132230/Macbeth.2010.DVDRip.XviD-VoMiT.torrent",
|
18
|
+
title: "The title",
|
19
|
+
tracker: "tti",
|
20
|
+
cookies: cookies
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should only list torrents with the right title" do
|
25
|
+
rest_client("http://tti.nu/browse.php?search=dvd&page=0&incldead=0", "search")
|
26
|
+
torrents = Torrents.tti.cookies(cookies).search("dvd")
|
27
|
+
|
28
|
+
torrents.results.each do |torrent|
|
29
|
+
torrent.title.should_not eq(torrent.torrent)
|
30
|
+
torrent.id.should_not eq(0)
|
31
|
+
end
|
32
|
+
|
33
|
+
torrents.should have(50).results
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be possible to parse the details view" do
|
37
|
+
rest_client("http://tti.nu/details.php?id=132470", "details")
|
38
|
+
torrent = create_torrent
|
39
|
+
|
40
|
+
torrent.should be_valid
|
41
|
+
torrent.seeders.should eq(70)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should be possible to list recent torrents" do
|
45
|
+
rest_client("http://tti.nu/browse.php?page=0&incldead=0", "recent")
|
46
|
+
Torrents.tti.cookies(cookies).should have(50).results
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should found 50 recent movies" do
|
50
|
+
rest_client("http://tti.nu/browse.php?c47=1&c65=1&c59=1&c48=1&page=0&incldead=0", "movies")
|
51
|
+
Torrents.tti.cookies(cookies).category(:movies).should have(50).results
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have a working find_by_details method" do
|
55
|
+
rest_client("http://tti.nu/details.php?id=132470", "details")
|
56
|
+
torrent = Torrents.tti.cookies(cookies).find_by_details("http://tti.nu/details.php?id=132470")
|
57
|
+
|
58
|
+
torrent.should_not be_dead
|
59
|
+
torrent.seeders.should eq(70)
|
60
|
+
torrent.tid.should eq("413a6c863f0a8f58180f97a52f635bd3")
|
61
|
+
torrent.domain.should eq("tti.nu")
|
62
|
+
torrent.imdb.should eq("http://www.imdb.com/title/tt1536044")
|
63
|
+
torrent.imdb_id.should eq("tt1536044")
|
64
|
+
torrent.id.should eq(132470)
|
65
|
+
torrent.torrent.should eq("http://tti.nu/download2.php/132470/Paranormal.Activity.2.2010.UNRATED.NORDIC.PAL.DVDR-iDiFF.torrent")
|
66
|
+
torrent.title.should eq("Paranormal.Activity.2.2010.UNRATED.NORDIC.PAL.DVDR-iDiFF")
|
67
|
+
end
|
68
|
+
end
|
data/torrents.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "torrents"
|
6
|
+
s.version = "1.0.0"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Linus Oleander"]
|
9
|
+
s.email = ["linus@oleander.nu"]
|
10
|
+
s.homepage = "https://github.com/oleander/Torrents"
|
11
|
+
s.summary = %q{Search and download torrents from your favorite bittorrent tracker using Ruby}
|
12
|
+
s.description = %q{Search and download torrents from your favorite bittorrent tracker using Ruby.
|
13
|
+
Get information like; subtitles, movie information from IMDB (actors, grade, original title, length, trailers and so on.), direct download link to the torrent.
|
14
|
+
}
|
15
|
+
|
16
|
+
s.rubyforge_project = "torrents"
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_dependency('rest-client')
|
24
|
+
s.add_dependency('nokogiri')
|
25
|
+
s.add_dependency('rchardet19')
|
26
|
+
s.add_dependency('classify', '~> 0.0.3')
|
27
|
+
s.add_dependency('movie_searcher', '~> 0.1.4')
|
28
|
+
s.add_dependency('undertexter', '~> 0.1.5')
|
29
|
+
|
30
|
+
s.add_development_dependency('rspec')
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: torrents
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Linus Oleander
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-22 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rest-client
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rchardet19
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: classify
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 0.0.3
|
58
|
+
type: :runtime
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: movie_searcher
|
62
|
+
prerelease: false
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.4
|
69
|
+
type: :runtime
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: undertexter
|
73
|
+
prerelease: false
|
74
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 0.1.5
|
80
|
+
type: :runtime
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rspec
|
84
|
+
prerelease: false
|
85
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: "0"
|
91
|
+
type: :development
|
92
|
+
version_requirements: *id007
|
93
|
+
description: "Search and download torrents from your favorite bittorrent tracker using Ruby. \n Get information like; subtitles, movie information from IMDB (actors, grade, original title, length, trailers and so on.), direct download link to the torrent.\n "
|
94
|
+
email:
|
95
|
+
- linus@oleander.nu
|
96
|
+
executables: []
|
97
|
+
|
98
|
+
extensions: []
|
99
|
+
|
100
|
+
extra_rdoc_files: []
|
101
|
+
|
102
|
+
files:
|
103
|
+
- .gitignore
|
104
|
+
- .rspec
|
105
|
+
- Gemfile
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- lib/torrents.rb
|
109
|
+
- lib/torrents/container.rb
|
110
|
+
- lib/torrents/trackers/the_pirate_bay.rb
|
111
|
+
- lib/torrents/trackers/torrentleech.rb
|
112
|
+
- lib/torrents/trackers/tti.rb
|
113
|
+
- spec/data/the_pirate_bay/details.html
|
114
|
+
- spec/data/the_pirate_bay/movies.html
|
115
|
+
- spec/data/the_pirate_bay/recent.html
|
116
|
+
- spec/data/the_pirate_bay/search.html
|
117
|
+
- spec/data/torrentleech/details.html
|
118
|
+
- spec/data/torrentleech/movies.html
|
119
|
+
- spec/data/torrentleech/recent.html
|
120
|
+
- spec/data/torrentleech/search.html
|
121
|
+
- spec/data/tti/details.html
|
122
|
+
- spec/data/tti/movies.html
|
123
|
+
- spec/data/tti/recent.html
|
124
|
+
- spec/data/tti/search.html
|
125
|
+
- spec/shared_spec.rb
|
126
|
+
- spec/spec_helper.rb
|
127
|
+
- spec/torrent_spec.rb
|
128
|
+
- spec/torrents_spec.rb
|
129
|
+
- spec/trackers/the_pirate_bay_spec.rb
|
130
|
+
- spec/trackers/torrentleech_spec.rb
|
131
|
+
- spec/trackers/tti_spec.rb
|
132
|
+
- torrents.gemspec
|
133
|
+
has_rdoc: true
|
134
|
+
homepage: https://github.com/oleander/Torrents
|
135
|
+
licenses: []
|
136
|
+
|
137
|
+
post_install_message:
|
138
|
+
rdoc_options: []
|
139
|
+
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: "0"
|
148
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: "0"
|
154
|
+
requirements: []
|
155
|
+
|
156
|
+
rubyforge_project: torrents
|
157
|
+
rubygems_version: 1.5.0
|
158
|
+
signing_key:
|
159
|
+
specification_version: 3
|
160
|
+
summary: Search and download torrents from your favorite bittorrent tracker using Ruby
|
161
|
+
test_files:
|
162
|
+
- spec/data/the_pirate_bay/details.html
|
163
|
+
- spec/data/the_pirate_bay/movies.html
|
164
|
+
- spec/data/the_pirate_bay/recent.html
|
165
|
+
- spec/data/the_pirate_bay/search.html
|
166
|
+
- spec/data/torrentleech/details.html
|
167
|
+
- spec/data/torrentleech/movies.html
|
168
|
+
- spec/data/torrentleech/recent.html
|
169
|
+
- spec/data/torrentleech/search.html
|
170
|
+
- spec/data/tti/details.html
|
171
|
+
- spec/data/tti/movies.html
|
172
|
+
- spec/data/tti/recent.html
|
173
|
+
- spec/data/tti/search.html
|
174
|
+
- spec/shared_spec.rb
|
175
|
+
- spec/spec_helper.rb
|
176
|
+
- spec/torrent_spec.rb
|
177
|
+
- spec/torrents_spec.rb
|
178
|
+
- spec/trackers/the_pirate_bay_spec.rb
|
179
|
+
- spec/trackers/torrentleech_spec.rb
|
180
|
+
- spec/trackers/tti_spec.rb
|