pirate_bay_ruby 0.0.3 → 0.0.4

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/Rakefile CHANGED
@@ -1,10 +1,10 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "pirate_bay_ruby"
3
3
 
4
- # task :test do
5
- # puts PirateBayRuby.search("Ubuntu")
6
- # end
4
+ task :test do
5
+ puts PirateBayRuby.search("Ubuntu")
6
+ end
7
7
 
8
- # task :download do
9
- # puts PirateBayRuby.search("Ubuntu", 5)
10
- # end
8
+ task :download do
9
+ puts PirateBayRuby.search("Ubuntu", 5)
10
+ end
@@ -16,17 +16,27 @@ module PirateBayRuby
16
16
  name = row.search('a.detLink')
17
17
  next if name.empty? # Skip empty names
18
18
 
19
+ temp = row.search('font.detDesc').text
20
+ match = temp.match /Uploaded (.*), ULed by .*/
21
+ description = match[1]
22
+
23
+ temp = row.search('td')
24
+ seeders = temp[2].text unless temp[2].nil?
25
+ leechers = temp[3].text unless temp[3].nil?
26
+
27
+
19
28
  magnet_link = ""
20
29
  row.search('a').each do |a|
21
- if a["title"] == "Download this torrent using magnet"
30
+ if a["href"].match /^magnet.*/
22
31
  magnet_link = a["href"]
23
32
  break
24
33
  end
25
34
  end
26
35
 
36
+
27
37
  if number == 0
28
38
  # Print to screen
29
- puts "#{cnt}:\t#{name.text}"
39
+ puts "#{cnt}:\tSE #{seeders}, LE #{leechers}, Date #{description}\t\t#{name.text}"
30
40
  elsif cnt == number
31
41
  # Download
32
42
  puts "Downloading: #{name.text}"
@@ -1,3 +1,3 @@
1
1
  module PirateBayRuby
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pirate_bay_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -107,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 1675470558500928932
110
+ hash: -1820902889336662923
111
111
  required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements:
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  segments:
118
118
  - 0
119
- hash: 1675470558500928932
119
+ hash: -1820902889336662923
120
120
  requirements: []
121
121
  rubyforge_project:
122
122
  rubygems_version: 1.8.25