pulse-downloader 0.1.38 → 0.1.42

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15b3ba4650d2aa0c01ba6f5456888889bfd888405177aa956f092ba2c0691065
4
- data.tar.gz: d28d3d28516d5cbdeaa255923e79e55526a364f70389a3d716ce9e8dec90af08
3
+ metadata.gz: 73defa92c0a7c2549c36a9ff9b5bb94b8b9cebf2de817c24bebf8d990d9eaaf7
4
+ data.tar.gz: dffa27233dca1a5a50c1b3ca5142ced965ec7b87cba0655c654db8067c421fd2
5
5
  SHA512:
6
- metadata.gz: ff848ed64e1adefe773378d9f8a6ccb2d9b7f533a58a10e008b8f7d1b1d678c16978426c0c4a3de8aaa2797c1647304b7dd996fcb979a4cc7a831ce229163fc1
7
- data.tar.gz: d9f01143d5d1a27ba38516b0ebed0a4ab49078e796f513d8351a90bbc8506077aa375b8b1a2ee8576b81836957f90ae31b5db31e8fdcc4b18a3dc30170f9b182
6
+ metadata.gz: 7d8b38aa36bd9fb8a5954872bb3509d31cbe6e2f59fe9963bd8d75a5456ccc858a18cd3e032134bdf5d4a0bb8800d53246dd36ef77958a3001608dbe93895a2a
7
+ data.tar.gz: 2b8fb4ef00b7b75e03535267d2f35b0fc9ccd2c7b67357d11318a4c03e99003a0022d255eaad978626176099713c59f76c9756e6486c01538c947328f6031926
@@ -1,5 +1,5 @@
1
1
  module Pulse
2
2
  module Downloader
3
- VERSION = "0.1.38"
3
+ VERSION = "0.1.42"
4
4
  end
5
5
  end
@@ -13,14 +13,13 @@ module Pulse
13
13
 
14
14
  private
15
15
 
16
- def fetch_folders(folder_url, custom_path_root)
17
- current_paths = extract_hrefs(get_response(folder_url), custom_path_root)
18
- return unless current_paths.compact.size > 0
16
+ def fetch_folders(folder_url, custom_path_root, inner_string)
17
+ current_paths = extract_hrefs(get_response(folder_url), custom_path_root, inner_string)
19
18
 
20
19
  @folder_urls = folder_urls.union(current_paths).uniq.compact
21
20
 
22
21
  current_paths.each do |path|
23
- fetch_folders(path, custom_path_root)
22
+ fetch_folders(path, nil, inner_string)
24
23
  end
25
24
 
26
25
  folder_urls
@@ -64,14 +63,21 @@ module Pulse
64
63
  ).uniq
65
64
  end
66
65
 
67
- def extract_hrefs(response, custom_path_root)
66
+ def extract_hrefs(response, custom_path_root, inner_string)
68
67
  parse_html(response.body)
69
68
  .css('a')
70
69
  .map { |link| "/#{link['href']}" }
71
70
  .reject { |link| link == "../" || link == "/../" }
71
+ .reject { |link| link.include?('.') } # Remove files
72
+ .map { |link| append_two_paths(inner_string, link) }
72
73
  .map { |link| add_base_url(link, custom_path_root) }
73
74
  end
74
75
 
76
+ def append_two_paths(inner_string, link)
77
+ return link if inner_string.nil?
78
+ "#{inner_string}/#{link}"
79
+ end
80
+
75
81
  def extract_all_urls(response, custom_path_root, type)
76
82
  parse_html(response.body)
77
83
  .to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulse-downloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - trex22