website_cloner 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/website-cloner +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e29501c6c5c642cdcebd2649ccd8b2c826af2ca541d3590951768e2714c3394f
|
4
|
+
data.tar.gz: 1e913c634f159d0f99192a82216402c648fb72bdb9a678bfd08e3474fdd4914a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a595638198f94dd1467dbb04ebaa4c4dd76564e2a551a343169d28ee24f35c406b028b8537431cb7fdf24793ed895e6e76a8fa9165fe9739c84b24bda902fb28
|
7
|
+
data.tar.gz: 1e591691504be97971bdc21f1bac590f0185b7c29f78985d72d46eb9d59e37e1adad789b38d6c6cd073b69a2d31217831f4b5dbad142ed0b72c124677f3c84fd
|
data/bin/website-cloner
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require_relative '../lib/website_cloner'
|
4
4
|
require 'optparse'
|
5
|
+
require 'uri'
|
5
6
|
|
6
7
|
options = {
|
7
8
|
max_pages: 20,
|
@@ -9,7 +10,7 @@ options = {
|
|
9
10
|
}
|
10
11
|
|
11
12
|
OptionParser.new do |opts|
|
12
|
-
opts.banner = "Usage: website-cloner <url>
|
13
|
+
opts.banner = "Usage: website-cloner <url> [output_directory] [options]"
|
13
14
|
|
14
15
|
opts.on("-m", "--max-pages PAGES", Integer, "Maximum number of pages to clone (default: 20)") do |m|
|
15
16
|
options[:max_pages] = m
|
@@ -25,8 +26,8 @@ OptionParser.new do |opts|
|
|
25
26
|
end
|
26
27
|
end.parse!
|
27
28
|
|
28
|
-
if ARGV.length
|
29
|
-
puts "Usage: website-cloner <url>
|
29
|
+
if ARGV.length < 1
|
30
|
+
puts "Usage: website-cloner <url> [output_directory] [options]"
|
30
31
|
puts "Run 'website-cloner --help' for more information."
|
31
32
|
exit 1
|
32
33
|
end
|
@@ -34,10 +35,16 @@ end
|
|
34
35
|
url = ARGV[0]
|
35
36
|
output_dir = ARGV[1]
|
36
37
|
|
38
|
+
if output_dir.nil?
|
39
|
+
uri = URI.parse(url)
|
40
|
+
domain = uri.host.sub(/^www\./, '')
|
41
|
+
output_dir = "./#{domain}"
|
42
|
+
end
|
43
|
+
|
37
44
|
begin
|
38
45
|
WebsiteCloner.clone(url, output_dir, max_pages: options[:max_pages], session_cookie: options[:session_cookie])
|
39
46
|
|
40
|
-
puts "\nWebsite cloned successfully!"
|
47
|
+
puts "\nWebsite cloned successfully into '#{output_dir}'!"
|
41
48
|
rescue StandardError => e
|
42
49
|
puts "\nAn error occurred during cloning: #{e.message}"
|
43
50
|
rescue Interrupt
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: website_cloner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bhavyansh Yadav
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|