sexy_download 0.1.0 → 0.2.0
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/README.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/sexy_download.rb +34 -11
- data/sexy_download.gemspec +2 -2
- metadata +4 -4
data/README.rdoc
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.2.0
|
data/lib/sexy_download.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'rubygems'
|
|
4
4
|
require 'tempfile'
|
|
5
|
+
require 'optparse'
|
|
5
6
|
require 'etc'
|
|
6
7
|
|
|
7
8
|
require 'sqlite3'
|
|
@@ -94,6 +95,12 @@ class CookieExtractor
|
|
|
94
95
|
end
|
|
95
96
|
end
|
|
96
97
|
|
|
98
|
+
def get_file_path!
|
|
99
|
+
domain = @list_file ? File.open(@list_file, "r").first : @domain
|
|
100
|
+
puts "\n== Domain: #{domain}"
|
|
101
|
+
@file_path = CookieExtractor.new(domain, @dir).extract!
|
|
102
|
+
end
|
|
103
|
+
|
|
97
104
|
raise %{
|
|
98
105
|
\nThis script is totally based on aria2 (http://aria2.sourceforge.net/)
|
|
99
106
|
I did not find on your machine using 'which aria2c'
|
|
@@ -106,21 +113,37 @@ raise %{
|
|
|
106
113
|
;)\n
|
|
107
114
|
} if `which aria2c`.empty?
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
opts = OptionParser.new do |opts|
|
|
117
|
+
opts.on("-l", "--list FILE", "List of files") {|list_file| @list_file = list_file}
|
|
118
|
+
end
|
|
119
|
+
opts.parse! ARGV
|
|
120
|
+
|
|
121
|
+
unless @list_file
|
|
122
|
+
raise %{
|
|
123
|
+
\nYou forgot to inform the download url, like:
|
|
124
|
+
$ sexy_download http://myDownloadUrl.com?q=ZHGT ~/My/Target/Dir
|
|
125
|
+
or
|
|
126
|
+
$ sexy_download http://myDownloadUrl.com?q=ZHGT\n
|
|
127
|
+
} if ARGV[0].nil?
|
|
128
|
+
|
|
129
|
+
@domain = ARGV[0]
|
|
130
|
+
@dir = File.expand_path(ARGV[1] || ".")
|
|
115
131
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@
|
|
132
|
+
else
|
|
133
|
+
puts "\n== File list detected: #{@list_file}"
|
|
134
|
+
@dir = File.expand_path(ARGV[0] || ".")
|
|
135
|
+
end
|
|
119
136
|
|
|
120
|
-
|
|
137
|
+
get_file_path!
|
|
138
|
+
|
|
139
|
+
# -x16 = 16 threads
|
|
140
|
+
# -j5 = 5 concurrently downloads
|
|
141
|
+
list_or_domain = @list_file ? "-j3 -i \"#{@list_file}\"" : "#{@domain}"
|
|
142
|
+
command = %{aria2c -c -x16 #{list_or_domain} --load-cookies="#{@file_path}"}
|
|
121
143
|
command << %{ --dir="#{@dir}"} if @dir
|
|
144
|
+
|
|
122
145
|
puts "\n== Downloading with:"
|
|
123
|
-
puts "\t#{command}\n"
|
|
146
|
+
puts "\t#{command}\n\n"
|
|
124
147
|
|
|
125
148
|
system(command)
|
|
126
149
|
|
data/sexy_download.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{sexy_download}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.2.0"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["T\303\272lio Ornelas"]
|
|
12
|
-
s.date = %q{2011-08-
|
|
12
|
+
s.date = %q{2011-08-24}
|
|
13
13
|
s.default_executable = %q{sexy_download}
|
|
14
14
|
s.description = %q{A Script that retrieves google chrome cookies and calls aria2c for multithreading download}
|
|
15
15
|
s.email = %q{ornelas.tulio@gmail.com}
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sexy_download
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
8
|
+
- 2
|
|
9
9
|
- 0
|
|
10
|
-
version: 0.
|
|
10
|
+
version: 0.2.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- "T\xC3\xBAlio Ornelas"
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-08-
|
|
18
|
+
date: 2011-08-24 00:00:00 -03:00
|
|
19
19
|
default_executable: sexy_download
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|