cherrypicker 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/.gitignore +2 -1
- data/lib/cherrypicker/download.rb +2 -0
- data/lib/cherrypicker/functions.rb +1 -1
- data/lib/cherrypicker/hotfile.rb +1 -0
- data/lib/cherrypicker/rapidshare.rb +2 -2
- data/lib/cherrypicker/version.rb +1 -1
- data/lib/cherrypicker.rb +0 -1
- data/test/test_helper.rb +4 -0
- data/test/unit/hostfile_test.rb +15 -0
- data/test/unit/rapidshare_test.rb +17 -0
- metadata +8 -3
data/.gitignore
CHANGED
@@ -13,7 +13,7 @@ def remote_query(url)
|
|
13
13
|
request.initialize_http_header({"User-Agent" => random_agent})
|
14
14
|
response = http.request(request)
|
15
15
|
if response["X-APICPU"]
|
16
|
-
if (response["X-APICPU"][/(\d*)\/\d*/, 1]).to_i >
|
16
|
+
if (response["X-APICPU"][/(\d*)\/\d*/, 1]).to_i > 9500
|
17
17
|
sleep 60 # seconds
|
18
18
|
end
|
19
19
|
end
|
data/lib/cherrypicker/hotfile.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# hotfile = Hotfile.new("http://hotfile.com/dl/110589431/6ad2666/ROT007-WEB-2011.rar.html", "username", "password")
|
4
4
|
# puts hotfile.link
|
5
5
|
# puts hotfile.hostname
|
6
|
+
# hotfile.download
|
6
7
|
class Hotfile
|
7
8
|
attr_accessor :link, :hostname, :filename, :username, :password
|
8
9
|
|
@@ -5,6 +5,7 @@
|
|
5
5
|
# puts rapid.fileid
|
6
6
|
# puts rapid.filename
|
7
7
|
# puts rapid.host
|
8
|
+
# rapid.download
|
8
9
|
class Rapidshare
|
9
10
|
attr_accessor :link, :fileid, :filename, :hostname, :username, :password
|
10
11
|
|
@@ -46,5 +47,4 @@ class Rapidshare
|
|
46
47
|
query = remote_query("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=download&" + create_url)
|
47
48
|
query.response.body[/DL:(.*).rapidshare.com/, 1] + ".rapidshare.com"
|
48
49
|
end
|
49
|
-
end
|
50
|
-
|
50
|
+
end
|
data/lib/cherrypicker/version.rb
CHANGED
data/lib/cherrypicker.rb
CHANGED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class HotfileTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "Information request" do
|
6
|
+
|
7
|
+
should "return response" do
|
8
|
+
response = Hotfile.new("http://hotfile.com/dl/110752208/b0cb939/test_file.txt.html", "username", "password")
|
9
|
+
assert response.filename.length > 0
|
10
|
+
assert response.hostname[/(.*)\.hotfile.com/, 1].length > 0
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class RapidshareTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "Information request" do
|
6
|
+
|
7
|
+
should "return response" do
|
8
|
+
response = Rapidshare.new("http://rapidshare.com/files/453165880/test_file.txt", "username", "password")
|
9
|
+
assert response.fileid =~ /\d*/
|
10
|
+
assert response.filename.length > 0
|
11
|
+
assert response.hostname.length > 0
|
12
|
+
assert !response.hostname.include?("DL: ")
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cherrypicker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Karl Entwistle
|
@@ -35,6 +35,9 @@ files:
|
|
35
35
|
- lib/cherrypicker/hotfile.rb
|
36
36
|
- lib/cherrypicker/rapidshare.rb
|
37
37
|
- lib/cherrypicker/version.rb
|
38
|
+
- test/test_helper.rb
|
39
|
+
- test/unit/hostfile_test.rb
|
40
|
+
- test/unit/rapidshare_test.rb
|
38
41
|
has_rdoc: true
|
39
42
|
homepage: http://karl.entwistle.info/
|
40
43
|
licenses: []
|
@@ -63,5 +66,7 @@ rubygems_version: 1.6.1
|
|
63
66
|
signing_key:
|
64
67
|
specification_version: 3
|
65
68
|
summary: Cherrypicker is Ruby Gem it lets you download from; Rapidshare and Hotfile
|
66
|
-
test_files:
|
67
|
-
|
69
|
+
test_files:
|
70
|
+
- test/test_helper.rb
|
71
|
+
- test/unit/hostfile_test.rb
|
72
|
+
- test/unit/rapidshare_test.rb
|