cherrypicker 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,10 +3,12 @@
|
|
3
3
|
# Download.new("http://download.thinkbroadband.com/10MB.zip", :location => '/location/tosave/file/')
|
4
4
|
# Download.new("http://download.thinkbroadband.com/10MB.zip", :location => '/location/tosave/file/', :size => 10485760)
|
5
5
|
|
6
|
+
require 'rubygems'
|
6
7
|
require 'net/http'
|
7
8
|
require 'net/https'
|
8
9
|
require 'progressbar'
|
9
10
|
require 'open-uri'
|
11
|
+
|
10
12
|
module Cherrypicker
|
11
13
|
class Download
|
12
14
|
attr_accessor :link, :size, :location, :progress, :filename, :finished
|
@@ -8,7 +8,7 @@ module Cherrypicker
|
|
8
8
|
class Hotfile
|
9
9
|
attr_accessor :link, :hostname, :filename, :username, :password, :size, :location, :query
|
10
10
|
|
11
|
-
def initialize(link,
|
11
|
+
def initialize(link, opts={})
|
12
12
|
if link =~ /hotfile.com\/dl\/\d*\/[0-9a-f]*\/.*.*\.html/
|
13
13
|
@link = link[/(.*)\.html/, 1] #remove .html from link
|
14
14
|
else
|
@@ -20,10 +20,12 @@ module Cherrypicker
|
|
20
20
|
o = {
|
21
21
|
:location => nil,
|
22
22
|
:size => nil,
|
23
|
+
:username => nil,
|
24
|
+
:password => nil,
|
23
25
|
}.merge(opts)
|
24
26
|
|
25
|
-
@username = username
|
26
|
-
@password = password
|
27
|
+
@username = o[:username]
|
28
|
+
@password = o[:password]
|
27
29
|
@size = o[:size]
|
28
30
|
@location = o[:location]
|
29
31
|
@filename = File.basename(uri.path)
|
@@ -7,17 +7,19 @@ module Cherrypicker
|
|
7
7
|
class Rapidshare
|
8
8
|
attr_accessor :link, :fileid, :filename, :hostname, :username, :password, :size, :location
|
9
9
|
|
10
|
-
def initialize(link,
|
10
|
+
def initialize(link, opts={})
|
11
11
|
uri = URI.parse(link)
|
12
12
|
|
13
13
|
o = {
|
14
14
|
:location => nil,
|
15
15
|
:size => nil,
|
16
|
+
:username => nil,
|
17
|
+
:password => nil,
|
16
18
|
}.merge(opts)
|
17
19
|
|
18
20
|
@link = link
|
19
|
-
@username = username
|
20
|
-
@password = password
|
21
|
+
@username = o[:username]
|
22
|
+
@password = o[:password]
|
21
23
|
@fileid = fileid
|
22
24
|
@size = o[:size]
|
23
25
|
@location = o[:location]
|
data/lib/cherrypicker/version.rb
CHANGED