torrent_api 0.2.6 → 0.2.7

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 CHANGED
@@ -11,4 +11,5 @@
11
11
  v0.2.3 Ruby 1.8.7 Support
12
12
  v0.2.4 Fixed an issue with bad filename creation in caching
13
13
  v0.2.5 Seriously, fixed a fix.
14
- v0.2.6 Now uses the .se TLD
14
+ v0.2.6 Now uses the .se TLD
15
+ v0.2.7 We still have torrent support after piratebay took it away. (Thanks rylwin)
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('torrent_api', '0.2.6') do |p|
2
+ Echoe.new('torrent_api', '0.2.7') do |p|
3
3
  p.description = "An API to query popular torrent websites"
4
4
  p.url = "http://www.github.com/hjhart/torrent_api"
5
5
  p.author = "James Hart"
@@ -75,13 +75,7 @@ module PirateBay
75
75
 
76
76
  def fetch_search_results
77
77
  url = "http://thepiratebay.se/search/#{search_string}/#{page}/7/#{category_id}" # highest seeded first
78
-
79
- uri = URI.parse(url)
80
-
81
- http = Net::HTTP.new(uri.host, uri.port)
82
- response = http.request(Net::HTTP::Get.new(uri.request_uri))
83
-
84
- response.body
78
+ open(url, { "User-Agent" => "libcurl-agent/1.0" }).read
85
79
  end
86
80
 
87
81
  private
@@ -108,4 +102,4 @@ module PirateBay
108
102
  end
109
103
 
110
104
 
111
- end
105
+ end
@@ -19,11 +19,11 @@ module PirateBay
19
19
  end
20
20
 
21
21
  self.id = row.inner_html.match(/torrent\/([\d]+)\//)[1]
22
- self.name = row.css(".detName").first.content
22
+ self.name = row.css(".detName").first.content.strip
23
23
  self.seeds = row.css("td")[2].content.to_i
24
24
  self.leeches = row.css("td")[3].content.to_i
25
25
  self.category = row.css("td")[0].css("a").map(&:content).join(" > ")
26
- self.link = row.css("td")[1].css("a[title='Download this torrent']").first[:href]
26
+ self.link = "http://torrents.thepiratebay.se/#{id}/#{name}.torrent"
27
27
  self.magnet_link = magnet_link
28
28
  self.status = status
29
29
 
@@ -59,4 +59,4 @@ module PirateBay
59
59
  end
60
60
 
61
61
  end
62
- end
62
+ end
data/torrent_api.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = "torrent_api"
5
- s.version = "0.2.6"
4
+ s.name = %q{torrent_api}
5
+ s.version = "0.2.7"
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 = "2012-02-03"
10
- s.description = "An API to query popular torrent websites"
11
- s.email = "hjhart@gmail.com"
9
+ s.date = %q{2012-04-07}
10
+ s.description = %q{An API to query popular torrent websites}
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/details.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"]
13
13
  s.files = ["CHANGELOG", "Manifest", "README.markdown", "Rakefile", "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/details.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", "torrent_api.gemspec"]
14
- s.homepage = "http://www.github.com/hjhart/torrent_api"
14
+ s.homepage = %q{http://www.github.com/hjhart/torrent_api}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Torrent_api", "--main", "README.markdown"]
16
16
  s.require_paths = ["lib"]
17
- s.rubyforge_project = "torrent_api"
18
- s.rubygems_version = "1.8.11"
19
- s.summary = "An API to query popular torrent websites"
17
+ s.rubyforge_project = %q{torrent_api}
18
+ s.rubygems_version = %q{1.7.2}
19
+ s.summary = %q{An API to query popular torrent websites}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  s.specification_version = 3
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: torrent_api
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease:
5
- version: 0.2.6
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 7
10
+ version: 0.2.7
6
11
  platform: ruby
7
12
  authors:
8
13
  - James Hart
@@ -10,7 +15,7 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2012-02-03 00:00:00 Z
18
+ date: 2012-04-07 00:00:00 Z
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: nokogiri
@@ -20,6 +25,9 @@ dependencies:
20
25
  requirements:
21
26
  - - ">="
22
27
  - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
23
31
  version: "0"
24
32
  type: :runtime
25
33
  version_requirements: *id001
@@ -31,6 +39,9 @@ dependencies:
31
39
  requirements:
32
40
  - - ">="
33
41
  - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
34
45
  version: "0"
35
46
  type: :runtime
36
47
  version_requirements: *id002
@@ -91,17 +102,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
102
  requirements:
92
103
  - - ">="
93
104
  - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
94
108
  version: "0"
95
109
  required_rubygems_version: !ruby/object:Gem::Requirement
96
110
  none: false
97
111
  requirements:
98
112
  - - ">="
99
113
  - !ruby/object:Gem::Version
114
+ hash: 11
115
+ segments:
116
+ - 1
117
+ - 2
100
118
  version: "1.2"
101
119
  requirements: []
102
120
 
103
121
  rubyforge_project: torrent_api
104
- rubygems_version: 1.8.11
122
+ rubygems_version: 1.7.2
105
123
  signing_key:
106
124
  specification_version: 3
107
125
  summary: An API to query popular torrent websites