torrent_api 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2f009ad8c2463b72f12b79d0124b92be5a0c1303
4
+ data.tar.gz: 65989265ba059e289997b7728d8dbffb6bc290e5
5
+ SHA512:
6
+ metadata.gz: 850872b61ddc3c6d5ce75dd8eb3a8b423a4bc369a5af404b17d6c00a6e72c98eed246b7f7a3bf3151cb4b0b4c77003117d231fb7109ea49b0fc74a56c1919e92
7
+ data.tar.gz: 970c968095bd4242e3bd23f3c134270ac22b023da98475e62835498cb3adc0fef340bad49c961ebcabbaa49667bb1a74f8f60de902e8808978f04e7bc2a3bd70
data/CHANGELOG CHANGED
@@ -13,4 +13,5 @@
13
13
  v0.2.5 Seriously, fixed a fix.
14
14
  v0.2.6 Now uses the .se TLD
15
15
  v0.2.7 We still have torrent support after piratebay took it away. (Thanks rylwin)
16
- v0.2.8 Fix to avoid pirate bay's advertisements
16
+ v0.2.8 Fix to avoid pirate bay's advertisements
17
+ v0.3.0 Merge PRs to fix URL for pirate bay
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- Echoe.new('torrent_api', '0.2.8') do |p|
2
+ Echoe.new('torrent_api', '0.3.0') 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"
@@ -13,3 +13,9 @@ task :default => :console
13
13
  task :console do
14
14
  sh "irb -rubygems -r ./lib/torrent_api.rb"
15
15
  end
16
+
17
+ begin
18
+ require 'rspec/core/rake_task'
19
+ RSpec::Core::RakeTask.new(:spec)
20
+ rescue LoadError
21
+ end
@@ -1,17 +1,19 @@
1
1
  module PirateBay
2
2
  class Search
3
3
  attr_accessor :search_string, :category_id, :page, :caching, :results
4
+ TPB_HOST = 'thepiratebay.org'
5
+ BASE_URL = "https://#{TPB_HOST}"
4
6
 
5
7
  def initialize(search_string, category='movies')
6
- self.search_string = URI.encode(search_string)
7
- self.category_id = PirateBay::Categories::IDS[category.upcase.strip.gsub(/S$/, "").to_sym] unless category == 0
8
- self.page = -1
8
+ @search_string = URI.encode(search_string)
9
+ @category_id = PirateBay::Categories::IDS[category.upcase.strip.gsub(/S$/, "").to_sym] unless category == 0
10
+ @page = -1
9
11
 
10
12
  @results = PirateBay::ResultSet.new(self)
11
13
  end
12
14
 
13
15
  def get_search_results
14
- if caching && File.exists?(cached_filename)
16
+ if caching && File.exist?(cached_filename)
15
17
  content = File.read(cached_filename)
16
18
  else
17
19
  content = fetch_search_results
@@ -49,7 +51,7 @@ module PirateBay
49
51
  def get_quality
50
52
  execute
51
53
  results = @results.map do |result|
52
- url = "http://www.thepiratebay.se/torrent/#{result.id}/"
54
+ url = "#{BASE_URL}/torrent/#{result.id}/"
53
55
  html = open(url).read
54
56
  p = PirateBay::Details.new html, :init
55
57
  puts "Fetching results"
@@ -74,7 +76,7 @@ module PirateBay
74
76
 
75
77
 
76
78
  def fetch_search_results
77
- url = "http://thepiratebay.se/search/#{search_string}/#{page}/7/#{category_id}" # highest seeded first
79
+ url = "#{BASE_URL}/search/#{search_string}/#{page}/7/#{category_id}" # highest seeded first
78
80
  open(url, { "User-Agent" => "libcurl-agent/1.0" }).read
79
81
  end
80
82
 
@@ -101,6 +103,5 @@ module PirateBay
101
103
  end
102
104
 
103
105
  end
104
-
105
-
106
106
  end
107
+
@@ -34,10 +34,11 @@ module PirateBay
34
34
  :E_BOOKS => 601,
35
35
  :COMICS => 602,
36
36
  :PICTURES => 603,
37
- :COVERS => 604
37
+ :COVERS => 604,
38
38
  }
39
39
 
40
40
  IDS = {
41
+ ALL: 0,
41
42
  :APPLICATION => 100,
42
43
  :MOVIE => 200,
43
44
  :AUDIO => 300,
@@ -45,4 +46,4 @@ module PirateBay
45
46
  :OTHER => 600
46
47
  }
47
48
  end
48
- end
49
+ end
@@ -18,7 +18,7 @@ module PirateBay
18
18
  def fetch_comments(params)
19
19
  index = params[:page] - 1
20
20
  if @comment_pages_html[index].nil?
21
- uri = URI.parse('http://thepiratebay.se/ajax_details_comments.php')
21
+ uri = URI.parse("#{PirateBay::Search::BASE_URL}/ajax_details_comments.php")
22
22
  res = Net::HTTP.post_form(uri, params)
23
23
  response = res.body
24
24
  @comment_pages_html[index] = response
@@ -23,7 +23,7 @@ module PirateBay
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 = "http://torrents.thepiratebay.se/#{id}/#{name}.torrent"
26
+ self.link = "https://torrents.#{PirateBay::Search::TPB_HOST}/#{id}/#{name}.torrent"
27
27
  self.magnet_link = magnet_link
28
28
  self.status = status
29
29
 
@@ -1,25 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # stub: torrent_api 0.3.0 ruby lib
2
3
 
3
4
  Gem::Specification.new do |s|
4
- s.name = %q{torrent_api}
5
- s.version = "0.2.8"
5
+ s.name = "torrent_api"
6
+ s.version = "0.3.0"
6
7
 
7
8
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib"]
8
10
  s.authors = ["James Hart"]
9
- s.date = %q{2012-11-20}
10
- s.description = %q{An API to query popular torrent websites}
11
- s.email = %q{hjhart@gmail.com}
11
+ s.date = "2017-03-23"
12
+ s.description = "An API to query popular torrent websites"
13
+ s.email = "hjhart@gmail.com"
12
14
  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
15
  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 = %q{http://www.github.com/hjhart/torrent_api}
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Torrent_api", "--main", "README.markdown"]
16
- s.require_paths = ["lib"]
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}
16
+ s.homepage = "http://www.github.com/hjhart/torrent_api"
17
+ s.rdoc_options = ["--line-numbers", "--title", "Torrent_api", "--main", "README.markdown"]
18
+ s.rubyforge_project = "torrent_api"
19
+ s.rubygems_version = "2.2.2"
20
+ s.summary = "An API to query popular torrent websites"
20
21
 
21
22
  if s.respond_to? :specification_version then
22
- s.specification_version = 3
23
+ s.specification_version = 4
23
24
 
24
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
26
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
metadata CHANGED
@@ -1,57 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: torrent_api
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 8
10
- version: 0.2.8
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - James Hart
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-11-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2017-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: nokogiri
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
26
17
  - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
32
20
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: hpricot
36
21
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: hpricot
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
40
31
  - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 3
43
- segments:
44
- - 0
45
- version: "0"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
46
34
  type: :runtime
47
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
48
41
  description: An API to query popular torrent websites
49
42
  email: hjhart@gmail.com
50
43
  executables: []
51
-
52
44
  extensions: []
53
-
54
- extra_rdoc_files:
45
+ extra_rdoc_files:
55
46
  - CHANGELOG
56
47
  - README.markdown
57
48
  - lib/demonoid/base.rb
@@ -66,7 +57,7 @@ extra_rdoc_files:
66
57
  - lib/torrent_reactor/base.rb
67
58
  - lib/torrent_reactor/result.rb
68
59
  - lib/torrent_reactor/result_set.rb
69
- files:
60
+ files:
70
61
  - CHANGELOG
71
62
  - Manifest
72
63
  - README.markdown
@@ -86,42 +77,30 @@ files:
86
77
  - torrent_api.gemspec
87
78
  homepage: http://www.github.com/hjhart/torrent_api
88
79
  licenses: []
89
-
80
+ metadata: {}
90
81
  post_install_message:
91
- rdoc_options:
92
- - --line-numbers
93
- - --inline-source
94
- - --title
82
+ rdoc_options:
83
+ - "--line-numbers"
84
+ - "--title"
95
85
  - Torrent_api
96
- - --main
86
+ - "--main"
97
87
  - README.markdown
98
- require_paths:
88
+ require_paths:
99
89
  - lib
100
- required_ruby_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
103
92
  - - ">="
104
- - !ruby/object:Gem::Version
105
- hash: 3
106
- segments:
107
- - 0
108
- version: "0"
109
- required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
- requirements:
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
112
97
  - - ">="
113
- - !ruby/object:Gem::Version
114
- hash: 11
115
- segments:
116
- - 1
117
- - 2
118
- version: "1.2"
98
+ - !ruby/object:Gem::Version
99
+ version: '1.2'
119
100
  requirements: []
120
-
121
101
  rubyforge_project: torrent_api
122
- rubygems_version: 1.7.2
102
+ rubygems_version: 2.2.2
123
103
  signing_key:
124
- specification_version: 3
104
+ specification_version: 4
125
105
  summary: An API to query popular torrent websites
126
106
  test_files: []
127
-